当按下导航控制器的按钮时tableview崩溃了?

问题描述:

numberOfRowsInSection返回0,当我按下navigationcontroller's后退按钮,当我把突破点 但- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath叫...应用程序崩溃..any帮助吗?当按下导航控制器的按钮时tableview崩溃了?

应的tableview的委托设置为nil,dealloc中释放你的表视图这样前:

- (void)dealloc{ 

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

} 

除了你试图在viewWillDisappear重新加载表,如果是的话,你应该避免它,并找到一个解决方法。

希望这会有所帮助。

尽量使numberOfRowsInSection方法返回1

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

我试过了..它没有工作.... – 2009-12-18 10:36:55

+0

你可以显示你的UITableViewDelegate的代码吗? – Thys 2009-12-18 11:02:02