i ran into the same problem first of all check mark on all orientation in built setting>targets>deployment info. then in your app delegate file implement this:
- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
UIViewController *currentViewController = [self topViewController];
// Check whether it implements a dummy methods called canRotate
if ([currentViewController respondsToSelector:@selector(canRotate)]) {
// Unlock landscape view orientations for this view controller
return UIInterfaceOrientationMaskAllButUpsideDown;
}
// Only allow portrait (standard behaviour)
return UIInterfaceOrientationMaskPortrait;
}
-(UIViewController*)topViewController {
return [self topViewControllerWithRootViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController*)topViewControllerWithRootViewController:(UIViewController*)rootViewController{
if ([rootViewController isKindOfClass:[UINavigationController class]]) { UINavigationController* aNavigationController = (UINavigationController*)rootViewController;
return [self topViewControllerWithRootViewController:aNavigationController.visibleViewController];
}
else
{
return rootViewController;
}
}
in your view controller(assume E) which you want to be in portrait/landscape..
add this:
//run time flag method
-(void)canRotate//also declare in header file {
}
- (BOOL)shouldAutorotate
{ return YES; }
you are done.
for more info you can go to this link