简体   繁体   中英

Rearranging Cells of UITableView without entering into editMode

As we all know, When the tableView goes into editMode, ios by default provide some functionalities such as delete buttton on left side and one more button to rearrange rows on right side of each cell.

What I am trying to do is implement only the rearranging of rows, by having a button on each cell, but without goin into edit mode.

I have tried this so far, dont know how to proceed further,

this function is called on click of button and dragged

- (void)dragCell:(CustomCell *)cell
{
    NSIndexPath *fromIndexPath = [m_tableView indexPathForCell:cell];

    NSArray *array1 = [Array2 objectAtIndex:[fromIndexPath row]];
    [Array2] removeObjectAtIndex:[fromIndexPath row]];
    [Array2] insertObject:page atIndex:[toDestIndexPath row]];**//dont know how to get this toDestIndexPath**

    [m_tableView moveRowAtIndexPath:fromIndexPath toIndexPath:toDestIndexPath];  

}

Please help me out .

Regards Ranjit

Use this. It does exactly what you want to do: https://github.com/FlorianMielke/FMMoveTableView

No edit mode needed. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM