The point is, the roundCorner is draw by a subview of
UITableViewCell, and mean while, it’s not a public class, there is no way you can get
layer.cornerRadius from any view. So we need to resolve this problem by ourselves.
There are 2 cases.
- There is only one cell.
This case is ease, just use
cell.contentView.layer.masksToBoundsto make it work.
There are more than one cell.
This case is a little bit difficult. We need to deal each cell separately. Use the
cell.contentView.layer.maskproperty to make it work. The first cell and the last cell has different round corner position. So draw the path and make it work.