UITableView - Select nearest row after row deletion.
- by sunnycmf
like build in apple notes app, after you swipe to delete the selected row, it will select the nearest available row automatically.
The logic should be:
if row count 0 then
if deleted_row == last row then
select deleted_row_index-1 row
else
select deleted_row_index+1 row
end
end
i have try to implement the above logic in the commitEditingStyle event, but the selection fail.
the selectRowAtIndexPath logic just don't work in this event, if i apply it in a button, it works.
any idea?