I used this extension to round two top corner of a table view.
self.tableView.roundCorners([.TopLeft, .TopRight], radius: 8)
extension UIView {
func roundCorners(corners:UIRectCorner, radius: CGFloat) {
let rect = self.layer.bounds
let path = UIBezierPath(roundedRect: rect, byRoundingCorners: corners, cornerRadii: CGSize(width: radius, height: radius))
let mask = CAShapeLayer()
mask.frame = rect
mask.path = path.CGPath
self.layer.masksToBounds = true
self.layer.addSublayer(mask)
self.layer.mask = mask
}
}
When I run the app the table view is always clipped off some of the bottom rows, but when I comment out the round corner line, the table worked perfectly fine. Anyone know why this is happen?
Side notes: if I set the cornerRadius for the table view then it works fine, but it round all four of the corner and I only want it round two top corner.