我的應用程序在調用方法[tableView reloadData]
表視圖後崩潰。這發生在刪除單行tableview(具有表視圖默認刪除行爲)並調用[tableView reloadData]
,然後在此代理numberOfSectionsInTableView
應用程序崩潰並顯示我崩潰消息[UITableViewCell _setDeleteAnimationInProgress : ] : message sent to deallocated instance
後,我Google搜索,但無法獲得健康的響應。如果有人遇到這種情況,那麼請幫助解決這個問題。下面是我的代碼。應用程序崩潰在tableview的reloadData方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
if(section==0)
return [[dbSingleton sharedInstance] get_players_count];
else if(section==1)
return 0;
}
- (NSString)tableView:(UITableView)tableView titleForHeaderInSection:(NSInteger)section{
if(section==0)
return @"Player Detail";
return nil;
}
- (UITableViewCellEditingStyle)tableView:(UITableView)tableView editingStyleForRowAtIndexPath:(NSIndexPath)indexPath{
if(indexPath.section==1)
return UITableViewCellEditingStyleNone;
else
return UITableViewCellEditingStyleDelete;
}
}
-(CGFloat)tableView:(UITableView)tableView heightForRowAtIndexPath:(NSIndexPath)indexPath{
return 44;
}
尋找答覆。提前致謝。
您是否正在更新數據源? – jsetting32 2014-10-27 13:18:16
請發佈完整的堆棧跟蹤。 – 2014-10-27 13:29:05
我會說當你通過你的tableView委託方法刪除行時[[dbSingleton sharedInstance] get_players_count]沒有被更新。 – miya 2014-10-27 13:51:33