Skip to content
Browse files

Check for valid interface orientation.

  • Loading branch information...
1 parent 2fc4349 commit c3e6eaf04c9d4e9c0d8abf1c9e12253aeced589f @mabundo mabundo committed May 8, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 AMTextFieldNumberPad.m
View
12 AMTextFieldNumberPad.m
@@ -257,8 +257,16 @@ - (void)changeButtonParams {
- (void)orientationDidChange:(NSNotification *)theNotification {
isRotating = TRUE;
-
- isPortrait = UIDeviceOrientationIsPortrait([UIDevice currentDevice].orientation);
+
+ NSUInteger orientation = [UIDevice currentDevice].orientation;
+
+ if (!UIDeviceOrientationIsValidInterfaceOrientation(orientation)) {
+ isPortrait = YES;
+ }
+ else {
+ isPortrait = UIDeviceOrientationIsPortrait(orientation);
+ }
+
buttonRectShow = (isPortrait) ? CGRectMake(0.00f, 427.00f, 105.00f, 53.00f) : CGRectMake(0.00f, 281.00f, 158.00f, 39.00f);
buttonRectHide = (isPortrait) ? CGRectMake(0.00f, 644.00f, 105.00f, 53.00f) : CGRectMake(0.00f, 443.00f, 158.00f, 39.00f);

0 comments on commit c3e6eaf

Please sign in to comment.
Something went wrong with that request. Please try again.