0

In this little test app, I have a ModalViewController that pops up over View One when you press the + button. That pulls up a NavigationViewController with three ViewControllers. The first allows you to create the post, the second is another modal view that allows you to choose a category and the last allows you to preview and 'Post' it. At this point (in the createTopic method) the data is sent and I dismiss the modal view:

[self dismissModalViewControllerAnimated:YES];

At this time, all the madness begins. View One is now presented in landscape mode, though I have all but upright portrait disabled. Further, because they're disabled, it won't switch back to portrait. Where have I failed?

I'm not even sure which part of the code to post to you. Help?

enter image description here

enter image description here

enter image description here

enter image description here

d2burke
  • 4,081
  • 3
  • 39
  • 51
  • possible duplicate of [Selective Autorotation within a UINavigationController and UITabBarController](http://stackoverflow.com/questions/1196758/selective-autorotation-within-a-uinavigationcontroller-and-uitabbarcontroller) – CodaFi Apr 18 '12 at 04:01

1 Answers1

1

"Disabling" upright portrait either in the app plist or in the summary tab doesn't cut it. That's merely a launch orientation. Call,

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 return UIInterfaceOrientationIsPortrait(interfaceOrientation);
} 

In every UIViewController to limit rotation to portrait only modes.

CodaFi
  • 43,043
  • 8
  • 107
  • 153
  • I have this is all of them. Anything else? – d2burke Apr 18 '12 at 03:52
  • also, i just added a 'Cancel' button to dismiss the very first modal view with the above [self dismissModalViewControllerAnimated:YES]; and it still switches it...this is ridiculous – d2burke Apr 18 '12 at 03:53
  • Nope. That's it. If you want to support lamdscape later, return YES and implement some serious autoResizingMasks. Oh, and in order for this to work with a UITabBar, you must implement it in ***every*** view controller. Check again. – CodaFi Apr 18 '12 at 03:53
  • this didn't work :( I even changed the return to an explicit 'NO' bool...still does it – d2burke Apr 18 '12 at 03:55
  • What happens if you return NO? – CodaFi Apr 18 '12 at 03:56
  • You're doing something wrong. See the [answer here](http://stackoverflow.com/questions/1196758/selective-autorotation-within-a-uinavigationcontroller-and-uitabbarcontroller). – CodaFi Apr 18 '12 at 04:02
  • ok, thanks CodaFi...I'm gonna take a look at this and report back – d2burke Apr 18 '12 at 04:03
  • CodaFi - you were right...I was focused on the three ViewControllers that popped up in the ModalViewController...ignoring the ORIGINAL ViewController which did not return 'NO'. Why is it that the summary or plist settings don't override this behavior? I didn't really gain any insight by the link you posted...but you encouragement to force the shouldAutorotateToInterfaceOrientation method to return 'NO' did the trick. Thanks for your help – d2burke Apr 18 '12 at 04:12
  • ah, yes, sorry for the delay on that – d2burke Apr 18 '12 at 04:26