调用numberOfRowsInSection但未调用cellForRowAtIndexPath

时间:2012-06-29 04:40:15

标签: iphone ios facebook parsing tableview

在我的tableView中, numberOfRowsInSection 被调用两次但是 cellForRowAtIndexPath 没有被调用?我想在tableView中显示Facebook好友列表(如果cellForRowAtIndexPath称我的问题已解决)。

我在这里得到了正确的值,但是第一次调用table方法因为解析好友列表没有完成它不会转到 cellForRowAtIndexPath 但是下次当我重新加载数据时它会显示值194(我在facebood中的朋友们在 numberOfRowsInSection 但仍然没有去 cellForRowAtIndexPath 。我对这个问题很累?

@implement RootViewController


//In this view i do two things. First use FBFeedPost to Fetch the Friend List from    Facebook and Second navigate to FBFriends view



FBFeedPost *post = [[FBFeedPost alloc]initWithFriendList:self.imageView.image];
    [post publishPostWithDelegate:self];


FBFriends *friendList=[[FBFriends alloc]initWithNibName:@"FBFriends" bundle:[NSBundle mainBundle]];
[[self navigationController] pushViewController:friendList  animated:YES];

@end


@implement FBFeedPost

//After parsing friends list i pass Array to a FBFriend class function   

FBFriends *obj1=[[FBFriends alloc]init];
[obj1 getFreindName:nameItems];

@end



@implement FBFriends


-(void)getFreindName:(NSMutableArray *)friendName
{
    friendsArray=friendName;

    NSLog(@"the count of name is %d",[friendsArray count]);// here i get right answer.

    [self.tableView reloadData];

}


@end

1 个答案:

答案 0 :(得分:2)

@ Stack.Blue:确定你用于tableView的属性是什么?使用@property(nonatomic,retain)UITableView *tableView; 或者下一个选项是你可以尝试在viewWillAppear方法中添加表。请告诉我它是否有效。

相关问题