Different orientations for iPhone and iPad in one storyboard

I am developing an iOS app that is actually a wrapper for an existing web app. It adds some additional functionality that can only be achieved this way.

I ended up developing an application using size classes and layout constraints. I used one storyboard for iPhone and iPad. The problem is that I want the iPhone app to only be able to use portrait mode, while the iPad can only use landscape mode (there are various web apps that are optimized for iPhone and iPad).

Is it possible to do this using only one storyboards, or do I need to use two storyboards (one for the iPhone, set for portrait only, and the other for iPad, set for landscape only); so duplicating my design?

+3


source to share


3 answers


Open info.plist file as code and paste this code:

<key>UISupportedInterfaceOrientations</key>
<array>
    <string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
    <string>UIInterfaceOrientationLandscapeLeft</string>
    <string>UIInterfaceOrientationLandscapeRight</string>
</array>

      



Works well for me!

+2


source


Yes, you can do that in iOS8, there is a very interesting feature called Responsive Layout, with which the same storyboard can now be used for iPads and iPhones running iOS 8. They don't need to maintain sync between storyboards for each device.



Here is a very nice tutorial , it will help you.

+2


source


Just paste this into your application delegate:

- (NSUInteger)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
    if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        return UIInterfaceOrientationMaskLandscape;
    else
        return UIInterfaceOrientationMaskPortrait;
}

      

-1


source







All Articles