Created
June 29, 2013 15:35
-
-
Save troyharris/5891570 to your computer and use it in GitHub Desktop.
Get the center of the view regardless of orientation: x is always horizontal and y is always vertical based on the current rotation
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
+(CGPoint)getViewRealCenter:(UIView *)view { | |
CGPoint realCenter; | |
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | |
realCenter = UIInterfaceOrientationIsLandscape(orientation) ? CGPointMake(view.center.y, view.center.x) : view.center; | |
return realCenter; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment