Commits

Ivan Andrus committed cae1103

Fixed crashing bug on iPad

Comments (0)

Files changed (1)

Classes/EditViewController.m

 }
 
 - (void)selectLanguage:(id)sender {
-    [self.navigationController.navigationBar removeGestureRecognizer:longPress];
 
     BOOL isPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
     if (!actionSheet) {
                        @"Singular",
                        nil];
     }
+
     if ( isPhone ) {
+        [self.navigationController.navigationBar removeGestureRecognizer:longPress];
         [actionSheet showFromToolbar:self.navigationController.toolbar];
     } else if ( [sender isKindOfClass:[UILongPressGestureRecognizer class]]
                && [sender state] == UIGestureRecognizerStateBegan ) {
 
         UIView *superview = [[sender view] superview];
         CGPoint p = [sender locationOfTouch:0 inView:superview];
+        // We need to remove the recognizer after we have queried if
+        // for view and superview.  We need to remove it or it
+        // prevents autorotation.  I'm not sure why.
+        [self.navigationController.navigationBar removeGestureRecognizer:longPress];
         [actionSheet showFromRect:CGRectMake(p.x, p.y, 1, 1)
                            inView:superview animated:YES];
     }