How to round only specific corners to a UIView in iOS using Swift
- July 01, 2019
- John Codeos
Today, I’ll show you how to round only specific corners in a UIView using maskedCorners (iOS 11 and above) and UIBezierPath (iOS 10 and below).
iOS 11 and above
If your app is targeting only devices with iOS 11 and above, add the following code and replace myUIView with your UIView:
.layerMinXMinYCorner = Top left corner
.layerMaxXMinYCorner = Top right corner
.layerMinXMaxYCorner = Bottom left corner
.layerMaxXMaxYCorder = Bottom right corner
iOS 10 and below
If your app supports iOS 10 and below, you can round specific corners using UIBezierPath:
If you have any questions feel free to DM me on Twitter @johncodeos or leave a comment below!