Cocoa touch UITableView lazyload-重新加载数据不工作

Cocoa touch UITableView lazyload-重新加载数据不工作,cocoa-touch,uitableview,lazy-loading,Cocoa Touch,Uitableview,Lazy Loading,这似乎是一个经典的问题,但我找不到任何线程的工作解决方案 我有一个UITableView,我想用从服务器加载的一些XML懒散地加载它 我的UITableView在.h中声明正确 IBOutlet UITableView *tblView; ... @property (nonatomic, retain) IBOutlet UITableView *tblView; …在接口生成器中连接并在.m中合成: @synthesize tblView; 现在。。。加载viewcontroller

这似乎是一个经典的问题,但我找不到任何线程的工作解决方案

我有一个UITableView,我想用从服务器加载的一些XML懒散地加载它

我的UITableView在.h中声明正确

IBOutlet UITableView *tblView;

...

@property (nonatomic, retain) IBOutlet UITableView *tblView;
…在接口生成器中连接并在.m中合成:

@synthesize tblView;
现在。。。加载viewcontroller时,UITableView将NumberOfSection委托给TableView,numberOfRowsInSection只调用一次。但是我现在没有任何数据,所以这些方法返回0

一旦我的数据从服务器加载并解析,我调用

[tblView reloadData]
。。。但它没有任何效果。代表们根本没有被召集

我也试过了

[[self tblView] reloadData]
而且它也不起作用

我甚至试图通过performSelectorOnMainThread发出调用,如下所示

...

[self performSelectorOnMainThread:@selector(fillTableWith:) withObject:arrAppointmentsFromServer waitUntilDone:NO];

...

- (void)fillTableWith:(NSMutableArray *)arrAppointmentsFromServer
{
    self.arrAppointments = arrAppointmentsFromServer;

    //Calls a refresh of the tableview
    [tblView reloadData];
}
这也不管用

有什么提示或解决办法吗

提前谢谢

好的,收到了

我的视图控制器实际上继承自UITableViewController

因此,我不必声明IBOutlet,合成它或其他任何东西

当需要重新加载数据时,我只需执行以下操作:

[[self tableView] reloadData];
因为tableView直接引用控件本身


现在可以正确调用NumberOfSectionsTableView和numberOfRowsInSection方法了

您是否仔细检查了委托是否已设置