0

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.

2 Answers2

1

You have to perform 2 changes :

  1. set Initial Orientation to Landscape ( either Home button left / right )
  2. set - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation to return NO
Raptor
  • 53,206
  • 45
  • 230
  • 366
0

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; }

Zian Chen
  • 510
  • 1
  • 5
  • 11
  • oh okay, so this isn't in the pageviewcontroller, this is in the subviews correct? – husammiwadi Nov 15 '12 at 04:19
  • I did try that, but by not allowing portrait mode, the whole project gets screwed up, since the page controller is set to slide on the width of the portrait mode. I haven't tried adding the code though, which I will do now – husammiwadi Nov 15 '12 at 04:21
  • So your suggestion fixed the view from rotating, thank you, but now the subviews are all mixed with each other. http://postimage.org/image/we1xdwn6r/ – husammiwadi Nov 15 '12 at 04:29
  • Do you know what I need to change in the pageviewcontroller.m to fix that issue http://github.com/wannabegeek/PageViewController theres the project – husammiwadi Nov 15 '12 at 05:09