开发者

tableview crashed when press back button of navigation controller?

开发者 https://www.devze.com 2022-12-14 13:52 出处:网络
the numberOfRowsInSection returns 0 when i press navigationcontroller\'s back button, but- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(开发者_开发技巧NSIndexPath *)ind

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

精彩评论

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