Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Can't find how to lock orientation in iOS 7

Hello,

okay so far I have 4 views that I have created in my storyboard. which are in a navigation view controller.

The first screen is the main page then a tableviewcontroller followed by a detailviewcontroller and finally another view controller.

I want all views to be locked in portrait except the last view controller that can be in portrait or landscape.

I can't seem to lock the orientation of the screens. I have searched all over and found many people having this issue and all the code I have found does not seem to work.

Do I need to create a class for the navigation view controller and set the code in there? I'm lost and figured I would reach out to my treehouse friends.

Thanks

Micahyah

1 Answer

Yes, that was it. I needed to add a NavigationViewController class and then adding the code to lock the display worked. Kind of Funny I answered my own post in the post itself. Do I need to do this and the answer was yes. haha