0

I have read countless answers and tried sooo many different things but I still cannot resolve my problem.

I'll explain it in a simple manner, first by describing my story board layout.

My storyboard structure is as follows

  • UITabBarController
    • UINavigationController 1
      • UIViewContoller 1
      • UIViewContoller 2
      • UIViewContoller 3
    • UINavigationController 2
      • UIViewContoller 4
      • UIViewContoller 5

The above structure is almost identical to what I currently have.

Now, this is what I would like to do; I would like to lock ALL UIViewControllers (including UITableViewControllers) so that they CANNOT rotate to landscape, except for UIViewController 3 and UIViewController 5 (Look at my structure above to see which ones they are). These two view controllers are able to be viewed in both landscape and portrait, however if the user clicks 'Back' on the navigation bar whilst they are in landscape view, the view controller will automatically rotate back to portrait.

How am I able to do this?

Additional Info:

Assume I am starting from a fresh slate and that I haven't already written code to try and solve the problem. Also assume that I have NOT made a class for each view controller. Thanks.

TaZz
  • 652
  • 7
  • 20
n00bAppDev
  • 610
  • 3
  • 10
  • 21
  • See this SO question: http://stackoverflow.com/questions/14174449/lock-the-orientation-of-viewcontroller – Jim Feb 06 '14 at 02:53
  • I don't think this will work with my case, I still wan't to allow only one child view controller to rotate, I do not want to lock all child view controllers under the navigation controller. – n00bAppDev Feb 06 '14 at 03:55

1 Answers1

0

Maybe the solution offered here: https://developer.apple.com/library/ios/featuredarticles/ViewControllerPGforiPhoneOS/RespondingtoDeviceOrientationChanges/RespondingtoDeviceOrientationChanges.html#//apple_ref/doc/uid/TP40007457-CH7-SW1

under the "Creating an Alternate Landscape Interface" section would work for you. In your special cases, listen for the rotation notifications and present your landscape versions there.

D.C.
  • 15,340
  • 19
  • 71
  • 102
  • I am fairly new to app development so I am not sure how to implement their code exactly. Although I think this is not what I am really looking for, it DOES NOT lock orientation for the views, it just allows you to display a view controller that supports landscape. – n00bAppDev Feb 06 '14 at 03:10