mahan
mahan

Reputation: 15055

iOS-13 - CornerRadius of UITableViewCell

I had set the cornerRadius of the layer of a UITableViewCell in its init method. It used to work in iOS 12 and 11, but it does not work in the latest version of 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.

How to set cornerRadius of UITableViewCell in iOS 13?

Upvotes: 1

Views: 579

Answers (1)

rantingmong
rantingmong

Reputation: 103

Do your cornerRadius modification in UITableView's contentView instead. Apple might have restricted layer modifications for UITableViews in iOS 13.

EDIT: do any of your view modification in UITableView's contentView property. In runtime, iOS performs other operations in the UITableView's root view. 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.

Upvotes: 4

Related Questions