从UITableViewCell showsReorderControl文档:
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.
我在tableviewController中有两个:
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
return YES;
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
NSLog(@"move from:%d to:%d", fromIndexPath.row, toIndexPath.row);
//just for test
}
我的单元格属性包括重新排序控件:
但是我看不到重新排序控件,我想念什么?
最佳答案
您是否通过以下方式将UITableView置于编辑模式
[tableView setEditing:YES animated:YES];
?
顺便说一句,您发布的第一种方法是不必要的,因为这是默认行为。
关于objective-c - 无法将表格重新排序才能正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10934739/