我在简单 View 中得到了UITableView
,它由UIViewController
控制
我实现了标准 UITableViewController
中的方法:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
但它不起作用。表格中没有显示任何内容
如何将数据上传到这个 UITableView?
最佳答案
- 您是否设置了
UITableView
的数据源属性?指向你的UIViewController
? - 声明您的 Controller 遵守
<UITableViewDataSource>
协议(protocol),通过这种方式,如果您错过了实现某些必需的方法,您将收到一些警告。
您是否尝试使用 UIViewController
代替 UITableViewController
?为什么? (正如Damien所说,这应该是第一个问题)。
关于ios - 如何使用 UITableView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9241393/