cannyboy
cannyboy

Reputation: 24426

UINavigation controller with different orientations

I want to create a UINavigationController, with a Master View Controller, and a Detail View Controller.

The Master View Controller can be rotated in Portrait and LandscapeRight, while the detail View Controller can only be only be viewed in LandscapeRight (the Detail shows a movie).

What's the best way of setting this up?

Upvotes: 2

Views: 106

Answers (2)

simply_me
simply_me

Reputation: 384

in iOS 7, the method

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 

has been deprecated. You can however use

- (BOOL)shouldAutorotate

to simply return a yes/no.

and then you can tell the viewcontroller which orientations are acceptable in

- (NSUInteger)supportedInterfaceOrientations

Upvotes: 0

rinzler
rinzler

Reputation: 236

I would recommend adding the following lines of code

On your Master View Controller:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

     return interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}

and on your Detail View Controller

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

     return interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}

That should do the trick.

Upvotes: 2

Related Questions