How to round only specific corners to a UIView in iOS using Swift

How to round only specific corners to a UIView in iOS using Swift

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!

Leave a Reply

avatar
  Subscribe  
Notify of

Follow me

Newsletter

Subcribe for weekly emails! Get my posts of the week right in your inbox!