Rez*_*our 6 objective-c uitableview ios xcode6
我有一个UITableViewController带静态单元格的表视图.我添加一些人造细胞UIImageView,并UILabel在其中.xcode故事板中的一切看起来都很好:
由于单元格是静态的,我不实现数据源方法这里是我的表视图控制器的代码:
#import "MainTableViewController.h"
@interface MainTableViewController ()
@end
@implementation MainTableViewController
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
Run Code Online (Sandbox Code Playgroud)
但是当我在模拟器中运行代码时,单元格的内容将不会出现:

这是场景层次结构:

Ron*_*oh1 19
带静态单元格的UITableView也没有显示给我 - 我试图删除并重新添加segue.一切都设置得很好.诀窍......
诀窍是从UITableViewController子类中删除以下行,单元格和节方法.它们由Xcode自动添加,但如果您使用的是静态单元格,则不需要在类中使用静态单元格.
– (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
– (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
– (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
删除这些方法后,您的单元格将正确显示.
| 归档时间: |
|
| 查看次数: |
5741 次 |
| 最近记录: |