iOS UITableViewCell 溢出 contentView

标签 ios uitableview

我正在向 UITableViewCellcontentView 添加 View ,其中一些 View 高于单元格的高度。目前,它只是溢出到它下面的单元格之上,但理想情况下我希望它被裁剪,这样任何不适合单元格的内容都不会显示。有可能吗?

最佳答案

[cell clipsToBounds:YES] 防止任何东西溢出单元格

[cell.contentView clipsToBounds:YES] 防止任何内容溢出 contentView 本身

来自docs

Setting this value to YES causes subviews to be clipped to the bounds of the receiver. If set to NO, subviews whose frames extend beyond the visible bounds of the receiver are not clipped. The default value is NO.

关于iOS UITableViewCell 溢出 contentView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17109847/

相关文章:

ios - 获取电子邮件并命名 Facebook SDK v4.4.0 Swift

iOS:不为 UICollectionView 中包含的 UITableView 调用 cellFowRow

ios - 取消选中 "checked cell"

ios - 线程、断点

javascript - IOS 上的位置不适用于 Ionic 中的地理定位

uitableview - UITableView iOS 5顶部的灰色线

ios - UITableViewCell 中的 UIImageView 以不同的约束刷新

uitableview - Swift:如何使用“编辑”按钮删除并停用滑动以删除?

ios - 如何保护我的音乐应用程序下载的音乐文件?

ios - Swift UISegmentedControl 如果更改