Last active
March 16, 2017 10:21
-
-
Save filsv/5c309beb6b041f03cc35311f85a20cdd to your computer and use it in GitHub Desktop.
Apply round corner/s on UIView, you can apply round corner to any side of UIView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func roundCorners(corners: UIRectCorner, radius: CGFloat) | |
{ | |
let size = CGSize(width: radius, height: radius) | |
let path = UIBezierPath(roundedRect: self.bounds, byRoundingCorners: corners, cornerRadii: size) | |
let mask = CAShapeLayer() | |
mask.path = path.cgPath | |
self.layer.mask = mask | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment