我有一个UIViewController类的MainViewController,在这个视图中我有一个表视图和另一个嵌入其中的视图。如您所见,我将表视图委托添加到视图控制器中。
@interface MainViewController : UIViewController <FlipsideViewControllerDelegate, UITableViewDataSource, UITableViewDelegate> {现在我的问题已经被问了大约50次,在互联网上的多次搜索,但我仍然无法找到一个解决方案。
为什么reloadData不能工作...?
我正在从XML提要下载信息,并从应用代理刷新提要:
- (void)applicationDidBecomeActive:(UIApplication *)application我插入了多个NSLogs,这是我找到的。来自XML提要的刷新数据没有问题。但是表格视图单元格没有被刷新。
我在其中放置了一个NSLog:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{尽管数据正在刷新,但当我调用tableView reloadData时,cellForRowAtIndexPath永远不会被调用。
我希望有人能在这个问题上帮助我,我已经在这个问题上工作了大约12个小时,但没有任何运气。我已经在多个网站上耗尽了搜索按钮...
仅供参考:-Table视图连接在接口生成器中。
按照表视图编程指南第51页开始的苹果示例,通过TableViewCells逐个加载-My表。
附加代码:
- (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;
}谢谢你的帮助
发布于 2011-09-19 07:55:42
现在一切都正常了。对我来说浪费了很多时间...
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[_mainViewController refresh];
[_mainViewController.tableView reloadData];
}
- (void)refresh {
Parser *xmlParser = [[Parser alloc] init];
[xmlParser parseRssFeed:@"http://www.somesite.com/file.xml" withDelegate:self];
[xmlParser release];
[self.tableView reloadData];
}发布于 2011-09-18 21:45:07
你有没有示例代码?
我的第一个想法是:
https://stackoverflow.com/questions/7461783
复制相似问题