matt saravitz
matt saravitz

Reputation: 157

Locking Interface Orientation?

On the initial view of my app I want the interface to be portrait only but on the view controllers after that it can be any orientation. I tried this code to lock it but it doesn't work and the view can still rotate:

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

Upvotes: 0

Views: 709

Answers (1)

dana0550
dana0550

Reputation: 1125

The reason that code is not working is most likely because you are running iOS 6. Try this code instead:

- (BOOL)shouldAutorotate {
    return NO;
}

Upvotes: 1

Related Questions