我有一个 UIViewController 类的 MainViewController,在这个视图中我有一个表格视图和另一个嵌入其中的视图。如您所见,我将表视图委托添加到视图控制器。
@interface MainViewController : UIViewController <FlipsideViewControllerDelegate, UITableViewDataSource, UITableViewDelegate> {
现在我的问题已经从互联网上的多次搜索中被问了大约 50 次,但我仍然无法找到解决方案。
为什么 reloadData 不起作用...?
我正在从 XML 提要下载信息,并从应用委托刷新提要:
- (void)applicationDidBecomeActive:(UIApplication *)application
我已经插入了多个 NSLog,这就是我发现的。来自 XML 提要的刷新数据没有问题。但是表格视图单元格没有被刷新。
我在其中放置了一个 NSLog:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
虽然数据正在刷新,但当我调用 [tableView reloadData]; cellForRowAtIndexPath 永远不会被调用。
我希望有人可以帮助我解决这个问题,我已经在这个问题上工作了大约 12 个小时,但没有运气。我已经用尽了多个网站上的搜索按钮......
仅供参考: - 表视图在 Interface Builder 中连接。
-我的表格正在通过 TableViewCells 一张一张地加载,遵循 Apples 示例,从 Table View Programming guide 的第 51 页开始。
附加代码:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return 17;
}
谢谢您的帮助