ios - Empty UITableView -
i have editable tableview , cant remove last object heres method :
- (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { [tableview beginupdates]; if (editingstyle == uitableviewcelleditingstyledelete) { [self deletepermittedfriend:[friendsids objectatindex:indexpath.row]]; [tabledatalist removeobjectatindex:indexpath.row]; } [tableview endupdates]; }
and if tabledatalist mutablearray have 1 last object gives me error :
* assertion failure in -[uitableview _endcellanimationswithcontext:], /sourcecache/uikit/uikit-2380.17/uitableview.m:1070 2013-05-21 11:41:47.306 ezmall[3398:907] * terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 0. number of rows contained in existing section after update (0) must equal number of rows contained in section before update (1), plus or minus number of rows inserted or deleted section (0 inserted, 0 deleted) , plus or minus number of rows moved or out of section (0 moved in, 0 moved out).'
it looks forgot call uitableview method:
– deleterowsatindexpaths:withrowanimation:
btw: practice read error messages.
Comments
Post a Comment