如何从UIPopoverController获取自定义表格单元格

时间:2013-07-11 02:50:22

标签: ios customization uipopovercontroller tablecell

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;
}

0 个答案:

没有答案