I have created an iPad application that only supports landscape orientation
(left and right).Ìt works perfectly on iOS 6
, but on iOS 5
the application is turned.
Could any one please help me to resolve this issue.
I have created an iPad application that only supports landscape orientation
(left and right).Ìt works perfectly on iOS 6
, but on iOS 5
the application is turned.
Could any one please help me to resolve this issue.
Just add following method in ViewController
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation {
return (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
shouldAutorotateToInterfaceOrientation
method deprecated in iOS 6, still needed for iOS 5 support.
If your app uses a UINavigationController, then you should subclass it and set the class in IB. You would then want to override the following methods to support both iOS5 and iOS6:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;
{
return interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight;
}
- (NSUInteger)supportedInterfaceOrientations;
{
return UIInterfaceOrientationLandscapeLeft | UIInterfaceOrientationLandscapeRight;
}
- (BOOL) shouldAutorotate;
{
return YES;
}
in ios 6 their are "shouldAutorotateToInterfaceOrientation" method deprecated,so u want to run the build in ios 5 and ios 6.
then,please go to build phase section and open the compile source.
then,paste the line in all viewcontroller
-fno-objc-arc
After that u paste the code
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
and make sure that in summary page support interface orientation are only select landscape left and right.
In your applicationDidFinishLaunching method put this code
[[UIDevice currentDevice] setOrientation:UIDeviceOrientationLandscape];
This will set you application to landscape mode irrespective of the device.