Skip to content

Instantly share code, notes, and snippets.

@Shilo
Created November 10, 2011 01:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shilo/1353807 to your computer and use it in GitHub Desktop.
Save Shilo/1353807 to your computer and use it in GitHub Desktop.
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