我正在向 UITableViewCell
的 contentView
添加 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/