首页 > 解决方案 > iOS-13 - UITableViewCell 的 CornerRadius

问题描述

UITableViewCell我在其init方法中设置了 a 层的cornerRadius 。它曾经在 iOS 12 和 11 中工作,但在最新版本的 iOS 中不起作用:iOS 13。

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

单元格有边框,但是当我向左滑动时(trailingSwipeActionsConfigurationForRowAt),单元格错过了边框。

如何在 iOS 13cornerRadius中设置?UITableViewCell

标签: iosswiftuitableview

解决方案


改为在'scornerRadius中进行修改。Apple 可能在 iOS 13 中限制了对 s 的层修改。UITableViewcontentViewUITableView

UITableView编辑:在'contentView属性中进行任何视图修改。在运行时,iOS 在UITableView的根视图中执行其他操作。我有一个问题,我无法UITableView在 iOS 10 中的单元格内执行点击操作,我修复它的方法是将所有内容移到里面contentView


推荐阅读