Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple category that allows one to easily set/get UIView rotation.
//
// 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
You can’t perform that action at this time.