![](/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.