使用未声明的类型 'ContactsTableViewCell'
Use of undeclared type 'ContactsTableViewCell'
我正在努力获取 phone 联系人。但是我得到了一个错误,比如 use of undeclared type ContactsTableViewCell
。我试过 UITableViewCell
但没用。我应该怎么办 ?
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 继承 UITableViewCell
,或者如果您已经创建了它,请确保将此 class 添加到您的目标中。
我正在努力获取 phone 联系人。但是我得到了一个错误,比如 use of undeclared type ContactsTableViewCell
。我试过 UITableViewCell
但没用。我应该怎么办 ?
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 继承 UITableViewCell
,或者如果您已经创建了它,请确保将此 class 添加到您的目标中。