Reordering rows in tableView while not in editing mode [duplicate]

独自空忆成欢 提交于 2019-12-05 15:05:28

You need to implement both

- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
- (BOOL)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath

and have your table view editing set to YES in order for the reorder controls to show.

use moveRowAtIndexPath:toIndexPath: UITableView method

UITableView implements below method.Use it to move rows, or chain them to have some animation of row by row.

- (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath

read in detail about it in Apple documentation.

Try to load this from end of your -viewDidLoad:

self.editing = NO;
[self editTable:nil];

editTable: is method action of edit button.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!