我正在努力获取手机通讯录。但我得到了一个错误,如使用未申报类型ContactsTableViewCell
。我试过UITableViewCell
,但没有奏效。我该怎么办 ?使用未声明的类型'ContactsTableViewCell'
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell
{
let cell = tableView.dequeueReusableCell(withIdentifier: "TableCell", for: indexPath) as! ContactsTableViewCell
let data = dataArray![indexPath.row] as! Data;
cell.lblName.text = data.name
cell.imgContact.image = data.image
return cell
}
您是否为ContactsTableViewCell创建了一个类? –
你的模块中的某个地方必须有一个'class ContactsTableViewCell {...}'。而'Data'是Swift 3中的保留字。不要将它用作自定义结构/类。 – vadian
复制并粘贴错误? – vikingosegundo