Created
November 10, 2011 01:30
-
-
Save Shilo/1353807 to your computer and use it in GitHub Desktop.
A simple category that allows one to easily set/get UIView rotation.
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
// | |
// UIView+Additions.h | |
// | |
// Created by Shilo White on 10/8/11. | |
// Copyright 2011 Shilocity Productions. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
@interface UIView (Additions) | |
@property (nonatomic, assign) float rotation; | |
@end | |
@implementation UIView (Additions) | |
- (void)setRotation:(float)rotation { | |
self.transform = CGAffineTransformMakeRotation(rotation); | |
} | |
- (float)rotation { | |
return atan2f(self.transform.b, self.transform.a); | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment