Search code examples
iphonexcodeuiscrollviewlandscapeuipageviewcontroller

UI Page controller adjusting to just landscape mode XCODE


recently I found a project with a page view controller which I really liked and decided to use in my own project.

http://www.wannabegeek.com/?p=168

The problem is, The page controller starts out in portrait and has an auto rotate feature to landscape. For my purposes, I don't need any auto rotate feature, I just want to be able to swipe back and forth between views in landscape mode only.

I tried changing the code, but was unsuccessful in making it landscape only, If someone could help edit the code to NOT auto-rotate, start in landscape, and stay in landscape that would be great!

Thank you.


Solution

  • Lemme add more detail to Shivan's answer:

    1. Select Landscape Left and Landscape Right in target. Tap on the project to get to this page.

    enter image description here 2.In the ViewController.m look for shouldAutorotateToInterfaceOrientation, make it return NO. See the following code.

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