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

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

问题描述

我正在创建一个带有自定义 UITableViewCellUITableView.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?

推荐答案

尝试使用 UITableViewCellaccessoryVieweditingAccessoryView 属性代替自己添加视图.

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 并且 editingAccessoryViewnil 时,这似乎会发生.

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天全站免登陆