ios - How to create new section and move row to it with animation -



ios - How to create new section and move row to it with animation -

i have code in tableviewdidselectrow :

[tableview beginupdates]; [tableview insertsections:[nsindexset indexsetwithindex:tableview.numberofsections] withrowanimation:uitableviewrowanimationfade]; [tableview moverowatindexpath:indexpath toindexpath:[nsindexpath indexpathforrow:0 insection:tableview.numberofsections ]]; [tableview endupdates];

after endupdates i'm getting crash with:

cannot move row newly inserted section

where mistake? how create new section , move row animation ?

it improve late, never, next generation, solution utilize deleterow + insertrow instead of moverow..., code:

[self.tableview beginupdates]; [self.tableview insertsections:[nsindexset indexsetwithindex:newsectionnum] withrowanimation:uitableviewrowanimationnone]; [self.tableview deleterowsatindexpaths:[nsarray arraywithobject:oldindexpath] withrowanimation:uitableviewrowanimationnone]; [self.tableview insertrowsatindexpaths:[nsarray arraywithobject:newindexpath] withrowanimation:uitableviewrowanimationnone]; [self.tableview endupdates];

ios objective-c uitableview

Comments

Popular posts from this blog

php - Edges appear in image after resizing -

ios8 - iOS custom keyboard - preserve state between appearances -

Delphi change the assembly code of a running process -