在iOS7中处于编辑模式时,UITableViewCell内容与删除按钮重叠 [英] UITableViewCell content overlaps delete button when in editing mode in iOS7

查看:127
本文介绍了在iOS7中处于编辑模式时,UITableViewCell内容与删除按钮重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用自定义 UITableViewCell 创建 UITableView 。 iOS 7的新删除按钮导致我的单元格布局出现一些问题。

I am creating a UITableView with custom UITableViewCells. iOS 7's new delete button is causing some problems with the layout of my cell.

如果我使用编辑按钮,这会使红色圆圈出现,我就会遇到问题,但如果我刷一个单元格,它看起来很完美。

If I use the "Edit" button, which makes the red circles appear I get the problem, but if I swipe a single cell it looks perfect.

这是使用编辑按钮的时间:

[self.tableView setEditing:!self.tableView.editing animated:YES];

这是我刷一个单元格的时间:

您可以看到我的标签与第一个示例中的删除按钮重叠。为什么这样做以及如何解决?

As you can se my labels overlaps the delete button in the first example. Why does it do this and how can I fix it?

推荐答案

尝试使用 accessoryView editingAccessoryView UITableViewCell 的属性,而不是自己添加视图。

try using the accessoryView and editingAccessoryView properties of your UITableViewCell, instead of adding the view yourself.

如果您希望在编辑和非编辑模式下显示相同的指示器,请尝试将两个视图属性设置为指向 uiTableViewCell 喜欢:

If you want the same indicator displayed in both editing and none-editing mode, try setting both view properties to point at the same view in your uiTableViewCell like:

self.accessoryView = self.imgPushEnabled;
self.editingAccessoryView = self.imgPushEnabled;

在IOS7中的表编辑动画中似乎有一个小故障,给出了删除按钮的重叠当切换回非编辑状态时, accessoryView 。当指定 accesoryView 并且 editingAccessoryView nil

There seems to be a glitch in the table editing animation in IOS7, giving an overlap of the delete button and the accessoryView when switching back to non-editing state. This seems to happen when the accesoryView is specified and the editingAccessoryView is nil.

这个故障的解决方法似乎是指定一个不可见的editingAccessoryView,如:

A workaround for this glitch, seems to be specifying an invisible editingAccessoryView like:

self.editingAccessoryView =[[UIView alloc] init];
self.editingAccessoryView.backgroundColor = [UIColor clearColor];

这篇关于在iOS7中处于编辑模式时,UITableViewCell内容与删除按钮重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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