How to use the following methods to support interface orientation in iOS 6.0:
shouldAutorotate
supportedInterfaceOrientations
preferredInterfaceOrientationForPresentation
As "shouldAutorotateToInterfaceOrientation" is deprecated in iOS 6.0.
Please provide code snippets to support your answers.
Thanks.
NicolasMiari's code worked for me. A little different spin I had a UITabBarController that presented UINavigationControllers and I was using StoryBoards. The UITabBarController's subclass's implementation is exactly the same and be patient with the Class selection for the Tab Bar Controller in Story Boards. It isn't immediately available even after building.
Deprecated method in iOS 5:
Replacement in iOS 6 and equivalent of this deprecated iOS 5 method above:
Hope this helps.
[edit #1: Added my UIViewController which successfully starts in Portrait mode in XCode 4.5 on iPhone 6.0 Simulator]
[#edit 2: Sample code from landscape only application which supports iOS 5 and iOS 6]
By the way, your settings on your Xcode project settings now take precedence. Make sure that you set the "Supported interface orientations" array properly in your project's settings. That was the issue for me. Removed the undesired ones and my app worked like it did when I compiled with Xcode 4.4.1
My app has an instance of a custom UINavigationController subclass, that presents several view controllers, all in portrait only, except when playing a video, in which case I want to additionally allow both landscape orientations.
Based on @uerceg 's answer, this is my code.
First, I enabled Portrait, Landscape Left and Landscape right in Xcode -> Target -> Summary.
In the UINavigationController subclass's implementation, I
#import
'ed<MediaPlayer/MediaPlayer.h>
.Then I implemented these methods:
https://devforums.apple.com/thread/165384?tstart=0
https://devforums.apple.com/thread/166544?tstart=0
There are a number of examples and suggestions in the above threads relating to supporting interface orientation changes on iOS6, the two threads related to issues with game centre views but should be enough to get you started.
You should also check the iOS6 release notes under UIKit, unfortunately I can't give you a direct link since I'm new.
Avoiding posting code here due to NDA
Hope that helps