I'm trying to make my app using SWRevealViewController
show the side panel automatically when the device is turned to landscape orientation, and I can make it do so when the app initially opens but not after that. Basically I'm trying to make it behave somewhat like the Mail app on the iPad except that you can still manually close the side panel on landscape mode. I tried this in the AppDelegate without success:
#import "AppDelegate.h"
#import "SWRevealViewController.h"
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
SWRevealViewController *revealViewController = (SWRevealViewController *)self.window.rootViewController;
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (orientation == UIInterfaceOrientationPortrait) {
}
if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) {
if (revealViewController.frontViewPosition == FrontViewPositionLeft) {
[revealViewController revealToggleAnimated:YES];
}
}
return YES;
}
Can anyone please tell me what I should be doing instead?