UITableViewCell在iOS8中不能剪辑到编辑模式的边界(适用于iOS7.1) [英] UITableViewCell not clipping to bounds in editing mode in iOS8 (works in iOS7.1)

查看:149
本文介绍了UITableViewCell在iOS8中不能剪辑到编辑模式的边界(适用于iOS7.1)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设置UITableViewCell的高度,以便它将剪辑,而不是该行的所有内容都可见。这在iOS7中都可以正常工作,无论是不编辑模式还是编辑模式。在iOS8中,它仅在不编辑模式下工作。在点击左侧的红色删除按钮后,编辑单元格的整个内容时会显示,以便您看到右侧的删除按钮。

I am setting the height of a UITableViewCell so that it will clip and not all the content for the row is visible. This works fine in iOS7 both "not edit" mode and "edit" mode. In iOS8 it is only working in "not edit" mode. When editing the entire content of the cell is shown after the red delete button on the left is tapped so that you see the delete button on the right.

我一直在设置 cell.clipsToBounds = YES 并认为这就是我需要做的全部。

I had been setting cell.clipsToBounds = YES and thought this was all I needed to do.

编辑:我也尝试了 cell.contentView.clipsToBounds = YES 但这不起作用。

EDIT: I also tried cell.contentView.clipsToBounds = YES but this didn't work.

iOS7 :(这就是我想要的)

iOS8:

推荐答案

看起来iOS 8中的UITableView在开始编辑时将cell.contentView.clipToBounds设置为NO。此代码可以帮助我解决您的问题:

Looks like the UITableView in iOS 8 set cell.contentView.clipToBounds to NO when begin editing. This code help me resolve your issue:

- (void)tableView:(UITableView *)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    cell.contentView.clipsToBounds = YES;
}

这篇关于UITableViewCell在iOS8中不能剪辑到编辑模式的边界(适用于iOS7.1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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