【发布时间】:2014-08-13 20:31:56
【问题描述】:
我有一个在storyboard 中设计的自定义单元格,它位于UITableViewController 内,可以很好地与自定义单元格配合使用。
现在,我尝试在 UITableViewController 和 UISearchDisplayController 上使用相同的单元格,但它不起作用。
这是我的方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath object:(PFObject *)object {
static NSString *CellIdentifier = @"CustomCell";
CustomCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier ];
}
cell.titleLabel.text = object[@"title"];
cell.subtitleLabel.text = object[@"subtitle"];
return cell;
}
它只返回白色的常规单元格,如果我使用默认的cell.textLabel.text,它会显示我的对象。
【问题讨论】:
标签: ios objective-c uitableview uisearchdisplaycontroller custom-cell