gresrun / GHSidebarNav

A clone of the new Facebook iOS UI paradigm
Apache License 2.0
607 stars 136 forks source link

Enable/disable orientation change from a single ViewController #10

Closed Urkman closed 11 years ago

Urkman commented 11 years ago

Hello,

how can I enable or disable the orientation change for a singe ViewController?

Thanks, Urkman

gresrun commented 11 years ago

I'm not sure I understand your question. Can you clarify and/or provide an example?

gresrun commented 11 years ago

@Urkman I'm going to close this. Reopen if you find an issue with GHSidebarNav regarding orientation changes.

Urkman commented 11 years ago

HI,

sorry for my late answer...

The problem here is, that the RevealViewController handles the shouldAutorotateToInterfaceOrientation callback, not the current contentViewController

I changed the following and now it works as expected for me:

#pragma mark UIViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orientation
{
    return [self.contentViewController shouldAutorotateToInterfaceOrientation:orientation];
}

- (BOOL)shouldAutorotate
{
    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
    if (orientation == UIDeviceOrientationUnknown) return YES;
    BOOL result = [self shouldAutorotateToInterfaceOrientation:orientation];
    return result;
}