My aim
Hello, my problem is quite simple. I have a UITableView
with a couple of cells. Some of them can be deleted (but not necessarily all of them), but all of them can be movable.
你好,我的问题很简单。我有一个带有几个单元格的UITableView。其中一些可以删除(但不一定全部删除),但所有这些都可以移动。
My problem
I do not understand how to realize this through the 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. I would like to set a cell as movable but not necessarily deletable. Is this possible?
我不明白如何通过iOS SDK实现这一点。使用tableView:canMoveRowAtIndexPath:和tableView:canEditRowAtIndexPath的组合:我只能将单元格设置为可删除,并最终可移动,但反之亦然。我想将一个单元格设置为可移动但不一定是可删除的。这可能吗?
1 个解决方案
#1
18
Movable:
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
Non-Deletable:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleNone;
}
#1
18
Movable:
-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
Non-Deletable:
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleNone;
}