Hi i have developed an iPad app which will completely run in landscape mode then installed the same app in ios 6 it forced to run in portrait mode so i added few things in my code through which ican run my app in landscape mode in both ios6 and lower versions. But my problem is after i rotate then i push to next view landscape right turns into landscape left. If i dont rotate then no problem it works perfectly. Even if i rotate also it should work perfectly pls help me to do this.
In view did load i gave the below lines.
- (void)viewDidLoad {
[super viewDidLoad];
if (IOS_OLDER_THAN_6)
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:NO];
//[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
}
Then i replaced the should autorotate with the below lines.
I will check the iOS version if it less than 6 i added below lines
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation{
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) ||(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
If The iOS version is 6 and above i will give the below lines of code
-(BOOL)shouldAutorotate
{
return YES;
}
- (NSUInteger)supportedInterfaceOrientations
{
return UIInterfaceOrientationMaskLandscape;
}
In the above code i have mentioned that it should support both landscapeleft and landscape right but in viewDidLoad i mentioned only landscape left so that is the problem. Some One guide me to give status orientation for both landscape left and landscapeRight. Even tried giving two orientations in two lines but no change so i commented one. That is the reason for my issue. Please someone help me to solve this issue.
You dont need to give
[[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeLeft animated:NO];
for your status bar to rotate. These two delegates
are sufficient. Also, when I tested the application on simulator it was not working properly but when I run the same application on device, then orientation is working properly. So, once try to run the application you have created on iOS6 device.