开发者

How do you hide the reorder control in a UITableViewCell without using reload?

In my app, when a user touches a table cell, the cell is disabled and the cell's reorder control disappears. If they touch it aga开发者_开发百科in, the cell is enabled and the reorder control reappears. The way I'm currently implementing this is by calling reloadRowsAtIndexPaths:withRowAnimation:, but this is sloooowww. If I just change the showsReorderControl property, nothing happens. I had some success with using setEditing:animated:, but it didn't work consistently. Any ideas? Thanks!


Ok, I found a solution. I needed to use -tableView:canEditRowAtIndexPath: in addition to –tableView:canMoveRowAtIndexPath: and then when it came time to show or hide the reorder control, I used the showsReorderControl and setEditing:animated: to get it all working.


The re-order control should only be visible when the table is in editing mode. To show it for a particular row, you need to implement –tableView:canMoveRowAtIndexPath: in your tableView's datasource. There should be no reason to call -reloadData just to show this control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜