I have created an app with a storyboard in Xcode and I now want to create an iPad version. I successfully created an iPad storyboard, but it currently runs with the code from the iPhone version.
The issue I am having is that the code for the iPhone is still running with the iPad storyboard. I would like to duplicate the iPhone code and adjust it for the iPad.storyboard, but I am not sure how to do that. Thanks.
I took a screenshot for you:
So switch the tabs and assign the appropriate storyboard. and make sure it is set to universal.
If I understand your problem, you now have two storyboards, one for iPhone and one for iPad, which are both working properly, but you want to modify part of the code just for the iPad version.
You should duplicate the classes you want to edit for the iPad version of your app and assign those new classes to the corresponding ViewControllers of the iPad storyboard.
Of course, you are still making a single, universal app.
Related
I have created an app in Swift and I want it to be available in both iPhone and iPad, but I would like the iPad to have a couple different layout variables, such as bigger buttons and pictures. Using auto-layout or Size Classes with constraints wasn't working and not letting me put them where I want them, so I was wondering how to make it so that when I open the simulator with an iPad, it opens the storyboard with the different View Controller layouts. I made a duplicate storyboard so I have main.storyboard and the copy is mainiPad.storyboard for the iPad only. If this can be done, please let me know! Thanks!!
This Tutorial is the old way, when You simply add iPad suffix in the file name.
This Post is the new way, introduced in Xcode 6; You simply select the storyboard name for ipad and iphone family in application plist file.
I have Xcode 6 beta installed and I'm trying to develop an universal app. Before Xcode 6, you had to create 2 separate Storyboards for iPad and iPhone and you could set it in the Deployment Info.
In Xcode 6, it seems that separation is gone. There aren't 2 tabs to set the storyboards individually.
But when you go to create a Storyboard, you are asked to choose a device family.
Can someone explain what's going on in Xcode 6 please?
Thank you.
To support the new Size Classes, you'll need to enable "Use Size Classes" in the File Inspector of your storyboard. This will allow you to configure your storyboard for multiple device sizes.
Note that this will make your storyboard incompatible with Xcode 5.
When you've enabled this, you'll see the size selector appear at the bottom of the screen. Use this to select your device size:
In your project preferences, you can still select a different storyboard for iPhone or iPad using the dropbown box. Notice that the storyboard name will persist if you select a different one for each device.
Even though this is still an option, Apple is moving developers towards a single, unified storyboard.
It seems Auto layout is used to support all devices now, yet you can create separate storyboards? Have you tried calling the separate storyboards in code in the app delegate
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
//Use iPhone Storyboard
} else {
//Use iPad Storyboard
}
After Xcode 6 > version for using different storyboard for iPhone and iPad need to follow xcode-6-separate-storyboard-for-ipad-and-iphone
Note : For Application which does not use Auto Layout, so while adding new storyboard for iPad and disabling auto layout, a pop will appear that's where you need keep size class data to iPad as shown in below screen.
I have created an Universal app. I have designed the app for iPad. But it doesn't work in iPhone. Will it work automatically or do i have to create all nibs separately for iPhone.
Of course it will not work automatically, if your design is for iPad only it will not work on the iPhone.
You will have to create separate XIBs for the iPad and iPhone, you can use the same viewController (.h and .m file) but seperate XIBx. Just add the device modifier to the file: MyViewController.xib and MyViewController~iphone.xib or MyViewController~ipad.xib.
Ofcourse it will not work for iPhone by itself. But its not difficult to add the support for iPhone.
Create a new StoryBoard for iPhone. Then open your iPad StoryBoard, the one you already created. Select all and copy. And then open iPhone StoryBoard and paste it in. All the controls and everything you have done in the iPad StoryBoard will be added to your iPhone StoryBoard.
After that you can do modifications in iPhone StoryBoard like remove or add some new controls etc.
Hope this helps!
I'm new with iOS and yesterday i learnt about storyboard. it works great. i refer to this link. I tried to create iPhone apps with a storyboard.
But now i want to create an universal apps, that means for iPhone and iPad. but also using the storyboard. lets say if i have the same UI, that wont be an issue. Same UI means, my iPhone UI using tab bar controller, my iPad also use a tab bar controller. I just need to point to the same class, and the result will be the same. Now, i want have a different UI. my iPhone will use a tab bar, but my iPad will use a split view.
here is my question :
is that possible to do that with device target universal? i mean iPhone with tab bar, iPad with split view.
if yes, how can i know which device is running? either i choose iPad or iPhone. How can i know i run on iPhone/iPad? what should I validate in the appdelegate?
For ipad storyboard, i drag a split view controller but i can't see any master detail whenever i run the apps. how can it be like that?
thanks. :)
If you create a Universal application (an application that supports both iPhone and iPad), Xcode will by default give you two Storyboards - one for iPhone, one for iPad. Under your target's settings you'll see a place where you can configure which Storyboard presents the main interface - you can set this separately for iPhone and iPad:
The OS will take care of loading the correct Storyboard for you.
If you want to detect in code whether you're running on an iPhone or iPad, you can use USER_INTERFACE_IDIOM(). For example:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
There's also UIUserInterfaceIdiomPad for iPad.
I have an iPhone app that works just fine on the iPhone. I am trying to get it to work on the iPad (v 1), but it won't move off the first view.
I have a TabBarController with 5 views. When I tap on the other views, they don't show. Is there something I need to do differently when using a TabBarController for the iPad?
BTW, it doesn't work on the similator either...
I'm making an assumption here but if you originally designed it for the iPhone only and want to convert it to a universal app for both iPhone and iPad, you will need to have two MainWindow.xib files. One for the iPhone and another for the iPad. And you'll have to specify those .xib files in the project settings. Set the Main and iPad interface files. An easy way to get a version of the iPad MainWindow.xib is to create a new project for the iPad and just copy it over to your own proj.