0

I'm fairly new at programming and using Xcode for iPhone App design. I wish to do the following:

  1. Start and stay in landscape mode for a children's app.
  2. Use swipe gestures to move from image to image. One image per swipe.

My problem is this:

even when starting in landscape mode, and after a swipe, the iphone simulator rotates to portrait mode.

Any advice or comment is greatly appreciated.

Doan Tran
  • 1
  • 2

1 Answers1

0

You have to define in shouldAutorotateToInterfaceOrientation: which modes you support.

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

will handle both landscape modes.

Vincent
  • 4,342
  • 1
  • 38
  • 37
  • Vincent: I found the answer. In xcode 4.5, I go to .plist file and go to supported interface orientations. – Doan Tran Oct 07 '12 at 21:53
  • Every view (in the storyboard) is connected to a view controller (the .m file). In the code, often close to the viedDidLoad is placed, this function shall be placed. This gives the advantage that you can specifically control the orientation of each view. (Please mark as answered) – Vincent Oct 08 '12 at 05:25
  • Answered #1 but still need answer to #2. Thanks. – Doan Tran Oct 11 '12 at 23:04
  • You have to trigger an IBAction via your button. In the function you can do anything. Like playing a sound, changing an image. – Vincent Oct 12 '12 at 12:41