![](/img/trans.png)
[英]How do I add a navigation item to a Table View Controller (with static cells) in Xcode Interface Builder?
[英]iOS development - How to display static cells created in Interface Builder with custom Table View Controller?
我试图用表格视图在静态单元格中显示某些内容。
首先,我在带有静态单元格的接口构建器中创建一个Table View Controller。
我从不指定自定义UITableViewController
类,它可以很好地工作。
但是由于我将其指定为MyTableViewController
类,因此表视图什么也不显示。
使用自定义UITableViewController
类时如何使静态单元格出现?
在方法中:
cellForRowAtIndexPath
您必须获取一个带有标识符的单元格,然后对其进行管理并返回:
static NSString *identifier = @"YourCellIdentifier";
CustomCell *cell = [tableView dequeueReusableCellWithReuseIdentifier:identifier forIndexPath:indexPath];
return cell;
您必须在接口构建器中设置标识符。.您必须选择单元格并将标识符写入检查器字段。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.