UITableView - Select nearest row after row deletion.

Posted by sunnycmf on Stack Overflow See other posts from Stack Overflow or by sunnycmf
Published on 2010-05-31T03:21:55Z Indexed on 2010/05/31 3:22 UTC
Read the original article Hit count: 366

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?

© Stack Overflow or respective owner

Related posts about uitableview

Related posts about iphone-sdk-3.0