Created
May 6, 2016 14:21
-
-
Save soggybag/f874aa0b8466b2cafc95dc38eba54996 to your computer and use it in GitHub Desktop.
UIView Rotaton
This file contains 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
extension UIView { | |
func rotateRad(r: CGFloat) { | |
self.transform = CGAffineTransformMakeRotation(r) | |
} | |
func rotateDeg(r: CGFloat) { | |
self.transform = CGAffineTransformMakeRotation(r.degreesToRadians) | |
} | |
} | |
// Include degrees to radians extension | |
// Usage | |
self.box.rotateRad(CGFloat(M_PI)) | |
// or | |
self.box.rotateDeg(45) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment