try this code, its working,
Your's Button Action:
isEnablePortraidMode = true;
NSNumber *number = [NSNumber numberWithInt:UIDeviceOrientationLandscapeLeft];
NSNumber *StatusBarOrientation = [NSNumber numberWithInt:UIInterfaceOrientationMaskLandscapeLeft];
[UIViewController attemptRotationToDeviceOrientation];
[[UIDevice currentDevice] setValue:number forKey:@"orientation"];
[[UIApplication sharedApplication] performSelector:@selector(setStatusBarOrientation:) withObject:StatusBarOrientation];
[UIViewController attemptRotationToDeviceOrientation];
and Add this method in Appdelegate
- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window{
if(isEnablePortraidMode)
{
return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape;
}
else
{
return UIInterfaceOrientationMaskPortrait;
}
}