简体   繁体   English

iOS-13 - UITableViewCell 的 CornerRadius

[英]iOS-13 - CornerRadius of UITableViewCell

I had set the cornerRadius of the layer of a UITableViewCell in its init method.我在它的init方法中设置了UITableViewCell层的cornerRadius。 It used to work in iOS 12 and 11, but it does not work in the latest version of iOS: iOS 13.它曾经在iOS 12和11中工作,但在最新版本的iOS:iOS 13中不起作用。

override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
    super.init(style: style, reuseIdentifier: reuseIdentifier)
    self.layer.cornerRadius = 10
}

The cell has border, but when I swipe left(trailingSwipeActionsConfigurationForRowAt) the cell misses its border.单元格有边框,但是当我向左滑动时(trailingSwipeActionsConfigurationForRowAt),单元格错过了边框。

How to set cornerRadius of UITableViewCell in iOS 13?如何在iOS 13中设置UITableViewCellcornerRadius

Do your cornerRadius modification in UITableView 's contentView instead.改为在UITableViewcontentView中修改cornerRadius Apple might have restricted layer modifications for UITableView s in iOS 13. Apple 可能对UITableView 13 中的 UITableView 进行了受限层修改。

EDIT: do any of your view modification in UITableView 's contentView property.编辑:在UITableViewcontentView属性中进行任何视图修改。 In runtime, iOS performs other operations in the UITableView 's root view.在运行时,iOS 在UITableView的根视图中执行其他操作。 I had an issue way back wherein I cannot do tap actions inside a UITableView cell in iOS 10, the way I fixed it is I moved everything inside contentView .我有一个问题,我无法在 iOS 10 的UITableView单元格内执行点击操作,我修复它的方法是将所有内容移到contentView中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM