Paul Peelen
Paul Peelen

Reputation: 10329

Landscape UIView in a UITabBarController

I have a UITabbarController with (so far) two navigation controller items. I can get the application to rotate by adding the shouldAutorotateToInterfaceOrientation to each class... but thats not exactly what I want.

What I want to do is to add a button in the UINavigationBar in one of the classes. When this button is pressed I want it to load another view into landscape mode. This view should not show any navigationbar or tabbar controller.

How can I get this to work?

Best regards, Paul Peelen

Upvotes: 1

Views: 786

Answers (2)

Vladimir
Vladimir

Reputation: 170839

You can try to use approach similar to Apple's AlternateViews sample.
Basically you should:

  1. Create your landscape view with appropriate size (480x300 for landscape if standard statusbar is visible)
  2. In your button handler push your landscape calling -pushModalViewController on your current view controller
  3. Apply necessary affine transformation to your view to be displayed correctly in landscape.

Upvotes: 3

Ole Begemann
Ole Begemann

Reputation: 135548

Use presentModalViewController:animated: and implement the modal view controller's shouldAutorotateToInterfaceOrientation: accordingly.

Upvotes: 3

Related Questions