Is there a way to set cornerRadius for only top-left and top-right corner of a UIView?
cornerRadius
UIView
I tried the following, but it end up not seeing the
iOS 11 , Swift 4 And you can try this code:
if #available(iOS 11.0, *) { element.clipsToBounds = true element.layer.cornerRadius = CORNER_RADIUS element.layer.maskedCorners = [.layerMaxXMaxYCorner] } else { // Fallback on earlier versions }
And you can using this in table view cell.