UITableViewCell accessoryType将不可见

时间:2014-12-09 02:46:56

标签: ios objective-c iphone xcode tableview

不会显示单元格的附件类型。我尝试了cell.accessoryTypecell.accessoryView(带图片)。除了这一点,表视图工作正常。有什么建议?感谢

我的代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"SimpleTableItem";

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];

if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle
                                  reuseIdentifier:simpleTableIdentifier];
}


cell.textLabel.text = @"Hi";
cell.detailTextLabel.text = @"Hi again!";
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;

2 个答案:

答案 0 :(得分:0)

确保您的表格单元格宽度适合屏幕。您是以编程方式创建UITableView还是在nib中?如果以编程方式创建,请检查表视图的帧大小,也可以在此处共享代码。

答案 1 :(得分:0)

xib的{​​{1}} / storyboard中选择配件类型。

enter image description here