1

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.

Prasad Devadiga
  • 2,573
  • 20
  • 43
user2401221
  • 519
  • 2
  • 9
  • 19
  • Have a look at this question: http://stackoverflow.com/questions/12434992/supporting-both-ios-6-and-ios-5-autorotation – Mikael May 29 '13 at 09:42
  • How have you already specified the orientation changes? I've found adding the supported orientations in the applications InfoPlist works for iOS5/6. – Nicholas Smith May 29 '13 at 09:53

4 Answers4

1

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.

Navnath Godse
  • 2,233
  • 2
  • 23
  • 32
0

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;
}
Oliver Atkinson
  • 7,970
  • 32
  • 43
0

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.

Shashi Sharma
  • 126
  • 1
  • 11
0

In your applicationDidFinishLaunching method put this code

[[UIDevice currentDevice] setOrientation:UIDeviceOrientationLandscape];

This will set you application to landscape mode irrespective of the device.

Sharanya K M
  • 1,805
  • 4
  • 23
  • 44