重新排序控制不显示在表视图上 [英] Reorder control isn't displayed on table view
问题描述
我创建了一个基于导航的应用程序模板的iOS应用程序,该应用程序由Core Data框架支持。
I created an iOS application based on navigation-based application template, the application is backed by Core Data framework.
当点击编辑按钮时,我希望行可重排序和可删除。
When clicking on Edit button, I want the rows to be reorder-able and delete-able.
在构建单元格时,我添加了以下行:
When constructing cells, I added this line:
cell.showsReorderControl = YES;
并且 tableView:canMoveRowAtIndexPath:
。
但是重排控件不显示在行中,我缺少一些东西?
But the reorder control isn't displayed in the row, Am I missing something?
推荐答案
从 UITableViewCell showsReorderControl文档:
要使重新排序控件出现,只设置这个
属性,但实现UITableViewDataSource方法
tableView:moveRowAtIndexPath:toIndexPath :.另外,如果数据
源实现了tableView:canMoveRowAtIndexPath:以返回NO,那么
重排序控件不会出现在指定的行中。
For the reordering control to appear, you must not only set this property but implement the UITableViewDataSource method tableView:moveRowAtIndexPath:toIndexPath:. In addition, if the data source implements tableView:canMoveRowAtIndexPath: to return NO, the reordering control does not appear in that designated row.
这篇关于重新排序控制不显示在表视图上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!