我希望允许重新排序UITableViewCell
s并通过滑动删除删除,但不能通过红色删除圈。
- (void)loadView
{
[super loadView];
[table setEditing:YES animated:NO];
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Perform delete here
}
}
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
// Perform move here
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewCellEditingStyleDelete;
}
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
此外,我已经尝试禁用编辑模式并调用-[UITableViewCell setShowsReorderControl:YES]
没有运气。
(来源:booleanmagic.com)
我想你必须做一些自定义触摸事件拦截。
在英语中:如果手指移动,x距离,水平跨越单元格,仅在该单元格中,则显示删除控件。
不知道如何关闭左边的圆圈,但我认为这是一个像“显示重新排序控制”的属性