ios - The number of sections contained in the collection view after the update must be equal to before the update -
i've uicollectionview contains 10 sections , each sections have 2 cells. trying delete cell getting this:
the number of sections contained in collection view after update (2) must equal number of sections contained in collection view before update (2)
this how remove:
nsuinteger arraylength = 1; nsuinteger integerarray[] = {0,0}; nsindexpath *apath = [[nsindexpath alloc] initwithindexes:integerarray length:arraylength]; [self.collectionfavs deleteitemsatindexpaths:[nsarray arraywithobject:apath]];
i want delete cell or section cells. mistake?
you should delete element datasource array. f.e. if method return 2 before deleting cell after deleting should return 1
- (nsinteger)collectionview:(uicollectionview *)collectionview numberofitemsinsection:(nsinteger)section { if (notdeleted) return 2; else return 1; }
in fact if return [array count] in method, should remove 1 object array before calling -deleteitemsatindexpaths
nsuinteger integerarray[] = {0,0}; nsindexpath *apath = [[nsindexpath alloc] initwithindexes:integerarray length:arraylength]; [array removeobjectatindex:0]; [self.collectionfavs deleteitemsatindexpaths:[nsarray arraywithobject:apath]];
Comments
Post a Comment