[英]How can I make a cell movable but not deletable in a UITableView?
Hello, my problem is quite simple.你好,我的问题很简单。 I have a
UITableView
with a couple of cells.我有一个带有几个单元格的
UITableView
。 Some of them can be deleted (but not necessarily all of them), but all of them can be movable.其中一些可以删除(但不一定全部),但它们都可以是可移动的。
I do not understand how to realize this through the iOS SDK.我不明白如何通过 iOS SDK 来实现这一点。 Using a combination of
tableView:canMoveRowAtIndexPath:
and tableView:canEditRowAtIndexPath:
I am only able to set a cell as deletable, and eventually movable, but not vice versa.使用
tableView:canMoveRowAtIndexPath:
和tableView:canEditRowAtIndexPath:
的组合我只能将一个单元格设置为可删除,并最终可移动,反之亦然。 I would like to set a cell as movable but not necessarily deletable.我想将一个单元格设置为可移动但不一定可删除。 Is this possible?
这可能吗?
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleNone;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.