iosxcodeios9.2

Rounded prototype corners iOS9.2


How would I change my cells in the UITableViewCells to have rounded corners? Kind of like this:

Rounded corners on cells

I like the gaps that are present, so is there away to adjust that as well?


Solution

  • In the ContentView of the UITableViewCell you can set, this lines the get the rounded corner.

    self.layer.cornerRadius = 5.0
    self.clipsToBounds = true
    self.layer.masksToBounds = true
    

    To give the gap, you need to set the default content view to Clear Color (to be transparent), and add a View inside the cell, with a smaller size then the cell.

    It will look like this in the storyboard. enter image description here