rjg
rjg

Reputation: 105

Disable autorotation for all but one view for iOS5+

just a little confused on how to disable autorotation in all views except one. I am using FGallery and i only want to enable rotation on that view.

Can anyone tell me how to proceed?

Upvotes: 1

Views: 702

Answers (2)

pablasso
pablasso

Reputation: 2499

For iOS 5.x you can implement this method from UIViewController, only returning YES for your supported orientation:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

For example, to only support portrait:

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    if (UIInterfaceOrientationIsPortrait(interfaceOrientation)) {
        return YES;
    }

    return NO;
}

Note that this method is deprecated after iOS 6.

Upvotes: 1

andrew lattis
andrew lattis

Reputation: 1549

have you implemented the shouldAutorotateToInterfaceOrientation:interfaceOrientation method in your view controller?

if you return no to everything except the orientation you want that should get you the desired result.

Upvotes: 0

Related Questions