进入编辑模式时,可以阻止UITableViewCell缩小吗? [英] Can I stop a UITableViewCell from shrinking when I enter edit mode?

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

问题描述

当您进入UITableView的编辑模式(已分组但我认为这也适用于其他类型)时,单元格会向右收缩以容纳删除选择按钮.对于不希望添加/插入/删除任何内容的单元格,是否有任何方法可以阻止此行为?IE.宽度保持不变.

When you enter edit mode for a UITableView (grouped but I believe this applies for the other types as well), the cells shrink to the right to accommodate the delete selection buttons. For cells that I dont wish to add/insert/delete any content, is there anyway to stop this behavior? ie. the width remains fixed.

我尝试将附件类型设置为UITableViewCellAccessoryNone,但这只会使带有减号的红色圆圈消失.

I've tried setting accessoryType to UITableViewCellAccessoryNone but that just makes the red circle with the minus disappear.

推荐答案

在tableViewController中使用它

Use this in your tableViewController

tableView:shouldIndentWhileEditingRowAtIndexPath:

tableView:shouldIndentWhileEditingRowAtIndexPath:

为您不想调整大小的单元格返回NO.

Return NO for the cells you don't want resizing.

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

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