我在下面的代码中收到错误。 ..L1name
、L1email
、L1code
数组的属性名nameData
、nameEmail
、nameCode
。
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableCell";
SimpleList1 *cell = (SimpleList1 *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.L1name.text = [nameData objectAtIndex:indexPath.row];
cell.L1email.text = [nameEmail objectAtIndex:indexPath.row];
cell.L1code.text = [nameCode objectAtIndex:indexPath.row];
return cell;
}
我想你的问题标题中有一个错别字,错误实际上是引用UITableViewCell
.这是因为UITableViewCell
没有自定义属性。
您需要确保已创建自定义单元格子类的实例,并且该变量具有正确的类类型,以便编译器知道哪些属性可用(如果需要,则强制转换):
MYCell *cell = (MYCell *)[tableView dequeueReusableCellWithIdentifier:...];