Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mackiee

macrumors member
Original poster
Mar 14, 2014
99
51
Just tested my app on iOS 13 and noticed that the rounded corners of custom UITableViewCell disappears when swiping the table cell left or right. This has been working perfectly in iOS12. Anyone else noticed the same?

The cell corners radius are are set in cellForRowAt after the cell has been dequeued.

cell.layer.masksToBounds = true
cell.layer.cornerRadius = 8

Must be an iOS 13 bug. Anyone figured out a workaround until the bug has been fixed?
 

mackiee

macrumors member
Original poster
Mar 14, 2014
99
51
I found the problem. It seems that in iOS 13 I need to set the cornerRadius to the cell's backgroundView and selectedBackgroundView. If I do that, and remove my original lines it works as in iOS 12.
 

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
You could try placing that code in the following method.

Code:
    functableView(_tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        cell.backgroundColor = .blue
        cell.layer.masksToBounds = true
        cell.layer.cornerRadius = 16
    }
 

mackiee

macrumors member
Original poster
Mar 14, 2014
99
51
You could try placing that code in the following method.

Code:
    functableView(_tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
        cell.backgroundColor = .blue
        cell.layer.masksToBounds = true
        cell.layer.cornerRadius = 16
    }
Tried it but it didn't work for me...
 

xStep

macrumors 68020
Jan 28, 2003
2,031
143
Less lost in L.A.
Odd given that I wrote a sample app to test it and confirm it worked. There is some disconnect I suppose. Glad you have a solution.

BTW I thought we we not suppose to mess with the cell, only it’s contentView.
 

mackiee

macrumors member
Original poster
Mar 14, 2014
99
51
Odd given that I wrote a sample app to test it and confirm it worked. There is some disconnect I suppose. Glad you have a solution.

BTW I thought we we not suppose to mess with the cell, only it’s contentView.
The problem for me was that I have definied my own backgroundView (with a gradient) and selectedBackgroundView (with some other special stuff). Prior to iOS 13 both of these views used the cornerRadius set on the cell layer but now that behaviour seems to have changed.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.