不能在iOS 7.1中的UITableViewCell的contentView上设置clipToBounds

iOS 7重新设计导致了UITableViewCells的视图层次结构的更改.单元格的内容视图被包装在一个名为UITableViewCellScrollView的私有类中.

在iOS 7中UITableViewCellScrollView将clipsToBounds设置为YES,UITableViewCellContentView将clipToBounds设置为NO.

在iOS 7.1中UITableViewCellScrollView将clipsToBounds设置为NO,UITableViewCellContentView将clipToBounds设置为NO.

如果您在iOS 7.1中调用[[self contentView] setClipsToBounds:YES]是否坚持.当在细胞上调用layoutSubviews时,UITableViewCellContentView将clipToBounds再次设置为NO.

[[self contentView] superview] setClipsToBounds:YES]在iOS 7.1中工作,并将UITableViewCellScrollView的clipToBounds设置为YES,但这是一个非常脆弱的解决方案.

覆盖布局在单元格上查看并调用[[self contentView] setClipsToBounds:YES]可以工作,但是另一个解决方案.

有没有人知道为什么这个变化已经做出了,而且更为强大的解决方案呢?

解决方法

如评论中所讨论的,现在在iOS7.1中唯一的解决方案是在小区本身设置clipsToBounds.

相关文章

当我们远离最新的 iOS 16 更新版本时,我们听到了困扰 Apple...
欧版/美版 特别说一下,美版选错了 可能会永久丧失4G,不过只...
一般在接外包的时候, 通常第三方需要安装你的app进行测...
前言为了让更多的人永远记住12月13日,各大厂都在这一天将应...