开发者

tableview crashed when press back button of navigation controller?

the numberOfRowsInSection returns 0 when i press navigationcontroller's back button, but - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(开发者_开发技巧NSIndexPath *)indexPath is called when i put break point...application crashes ..any help please?


you should set the delegate of tableview to nil, dealloc before releasing your table view like this:

- (void)dealloc{

[myTableView setDelegate:nil];
[myTableView release];
myTableView = nil;

}

besides are you trying to reload the table in viewWillDisappear, if yes you should avoid it and find a workaround for this.

Hope this helps.


Try to make the numberOfRowsInSection method return 1

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{
    return 1;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜