删除UITableViewCell编辑模式缩进? [英] Remove UITableViewCell Edit Mode Indentation?

查看:381
本文介绍了删除UITableViewCell编辑模式缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个分组的UITableView,当进入编辑模式时,单元格缩进。我需要在进入编辑模式时停止细胞缩进。

I have a grouped UITableView and when going into edit mode, the cells indent. I need to stop the cells indenting when going into edit mode.

我尝试了两件事:

cell.shouldIndentWhileEditing = NO;

-(BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    return NO;
}

进入编辑模式时,这些都不会停止单元格缩进。所以我希望有人可以提供帮助,谢谢。

Neither of these stop cell indentation upon entering edit mode. So I hope someone can help, thanks.

推荐答案

按照文档建议的方式做,引用 [UITableViewCell willTransitionToState:]

Do it the way documentation suggests, quoting [UITableViewCell willTransitionToState:]:


UITableViewCell的子类可以实现此方法来动画对单元格的其他更改进行动画处理改变国家。每当单元格在状态之间转换时,UITableViewCell都会调用此方法,例如从正常状态(默认)到编辑模式。自定义单元格可以设置和定位以新状态显示的任何新视图。 然后,单元格接收layoutSubviews消息(UIView),在该消息中,它可以将这些新视图放置在新状态的最终位置。重写此方法时,子类必须始终调用super。

Subclasses of UITableViewCell can implement this method to animate additional changes to a cell when it is changing state. UITableViewCell calls this method whenever a cell transitions between states, such as from a normal state (the default) to editing mode. The custom cell can set up and position any new views that appear with the new state. The cell then receives a layoutSubviews message (UIView) in which it can position these new views in their final locations for the new state. Subclasses must always call super when overriding this method.

换句话说,您可以更改<$ c $的位置和大小c> [UITableViewCell contentView] 在 [UITableViewCell layoutSubviews 中,取消压制。

In other words, you can change the position and size of the [UITableViewCell contentView] in [UITableViewCell layoutSubviews, to cancel the indendation.

这篇关于删除UITableViewCell编辑模式缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆