My app is crashing after calling method of [tableView reloadData]
table view. This is occurring on after deleting a single row of tableview(with table view default deleting behavior) and call [tableView reloadData]
and then right after this delegate numberOfSectionsInTableView
app gets crash and show me crash message [UITableViewCell _setDeleteAnimationInProgress : ] : message sent to deallocated instance
, I googled but couldn't able to get healthy response. So kindly help to find out this issue if any one face this sort of crash. Here below is my code.
- (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;
}
Looking for response. Thanks in advance.
Finally, I found solution. What I was doing wrong is that I am calling method reloadData
on commitEditingStyle
, its mean reloading data before deleting row, As mention in answer of This Thread. I hope this will help others as well.
Thanks for your participations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With