我不知道我做错了什么,但cellForRowAtIndexPath表格视图的方法只被调用一次。
这是我的代码:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
NSLog(@"--->%d",[collaboratoresdata count]);
return [collaboratoresdata count];
}
当我的collaboratoresdata数组被填满时,我会打电话[_collaboratortblView reloadData]来重新加载表格视图。
我成功进入3,NSLog(@"--->%d",[collaboratoresdata count]);但cellForRowAtIndexPath只接到一次电话。
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
// add a placeholder cell while waiting on table data
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
}
cell.selectionStyle=UITableViewCellSelectionStyleNone;
NSLog(@"tableView:%d",[indexPath row]);// i am getting 0 here than after its not calling
return cell;
}