Objective c tableView:cellForRowAtIndexPath:从未调用,但行和标题为>;0
my UIViewController中的tableView具有NSMutableArray作为数据源 将新对象添加到可变数组后,我调用[tableView reloadData],它正确地调用:Objective c tableView:cellForRowAtIndexPath:从未调用,但行和标题为>;0,objective-c,ios,Objective C,Ios,my UIViewController中的tableView具有NSMutableArray作为数据源 将新对象添加到可变数组后,我调用[tableView reloadData],它正确地调用: - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 返回数组中元素的正确更新量。然而,该方法: - (UITableViewCell *)tableView:(UITable
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
返回数组中元素的正确更新量。然而,该方法:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
之后不会调用。我想,当我重新加载表视图的数据时,就会调用这样的方法
分段法:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView
在我的代码中总是返回1。
谢谢这是什么意思
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
方法返回
您是否已将其管理为返回数据源的计数,如您所述,该数据源是NSMutableArray
在此方法调用中:
[array count];
这是一个线程问题。。。我用以下方法修复了它:
dispatch_async( dispatch_get_main_queue(), ^{
[table reloadData];
});
有人给它打过电话吗?您在表中看到过任何单元格吗?@jrturton是的,只有在表第一次初始化时才看到。但是我无法在数组更新时更新表。您能提供更多详细信息吗?很难理解发生了什么事。谢谢。我已经将添加了所有这些代码的UIViewController类设置为tableview的数据源和委托。在某一点上,我将对象添加到一个数组中,当这个数组被更新时,表应该被更新。它返回>0[tableView reloadData]方法调用要调用的数据源和委托方法。你能给我看一下这个的代码吗?