Popover 是一个UITableViewController
,table-cell 的类是一个自定义类 'MyOptionsTableViewCell',它有四个UILabel
.
当表加载并调用cellForRowAtIndexPath
方法时,我想绑定自定义数据,但代码不起作用。
该代码是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"OptionCell";
MyOptionsTableViewCell *cell =(MyOptionsTableViewCell*) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell =[[MyOptionsTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
ProdOption *currentOption = [self.options objectAtIndex:indexPath.row];
//This four line code not work
cell.lblTitle.text = currentOption.Title;
cell.lblPoints.text = currentOption.Dig;
cell.lblStatus.text = currentOption.Status;
cell.lblDescription.text = currentOption.Description;
//This lines code worked well
//cell.textLabel.text = currentOption.Title;
return cell;
}