Where is UISplitViewController in universal App? - ios

I made an application for the iPhone and now I want to make a port for the iPad. So I changed the setting to Universal. I would like to use for the iPad version the Split View, but I do not see it anywhere (I use Storyboard). Please help. Thanks

Check the object library in the lower-right corner:

After you switch the app to universal you have to create a separate iPad storyboard. Goto New File and under User Interface choose storyboard. When you click next it will ask you device family, choose iPad. After you create the storyboard and go there you will see the Split View Controller as in #Aaron Brager answer.

Related

iOS - Open a different Stroryboard based on the device size

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.

iPad storyboard changes not happening?

I started a xcode project for iPhone and now I'm working it also for iPad (Universal App).
So in devices I put Universal and I create the iPad storyboard and make the necessary changes (in plist file and build settings) and now anything I edit in the ipad storyboard is done, obviously yes on code but not in the storyboard (I'm working without auto-layout so Its disabled in both storyboards).
What can I do? I've checked everything and it's in order.
Just a guess, but you might be getting an error showing up in your debug console. Make sure that the storyboard has an entry point. Select the viewContoller that is the entry point and check the checkbox for "is initial view controller" in the utilities pane.
did you check the target> General> their did you give the storyboard for ipad? if you look, you can see the selection on iphone and your iphone storyboards name below it. Change it to ipad and enter the storyboard?

Where to change orientation restrcitions in Interface Builder

For an iOS 7 app, I have a storyboard with a simple UINavigateController and a ViewController. I remember having limited the navigation and/or view controller to Landscape, and now I can't find anymore where I had changed this. I am not talking about the appearance of the controller on the Interface Builder screen, but the supported orientations. I tried to override it in the code, but it doesn't help.
Any clue where to find this again ? Thanks.
If you want to restrict the orientation on iPhone you can easily click the project on the navigator and when you click, go on the general page. Below you can uncheck the orientations you don't want.
Just keep in mind, you cant lock orientations for an iPad app. An iPad app should support all the orientations. (based on the apple Human Interface Guidelines)
To change/restrict the types of orientations of your app from your Interface Builder, Try these steps.
Open up your project navigator and click on your project.
You will see a screen like this.
Under the general tab, See the Deployment Info Options. There you check/uncheck the types of orientations you want to keep or not.
Hope this helps.

Create universal app using iOS StoryBoard that have different UI

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.

Xcode storyboard: Why does the iPad storyboard show iPhone sized views?

I have a universal app that uses storyboards. There is an iPhone storyboard and an iPad storyboard. However, in interface builder, the viewcontrollers for the iPad storyboard are still sized for the iPhone. How do I get the iPad storyboard to show iPad sized view controllers?
I realize that the view controller display in interface builder is design-time-only eye-candy, but having iPhone sized VCs makes it really hard to lay out the UI correctly.
After some digging through the storyboard source code, it turns out that the iPad storyboard was copied from the iPhone storyboard. So, the question really became how do I convert an iPhone storyboard into an iPad storyboard?
The answer is surprisingly simple. I ran across this SO answer -- to convert an iPhone storyboard to an iPad storyboard, do the following:
From Xcode, right-click on the storyboard and choose Open As ->
Source code
Search for targetRuntime="iOS.CocoaTouch"and change it to targetRuntime="iOS.CocoaTouch.iPad"
Right-click on the storyboard again and choose Open As -> iOS Storyboard
The storyboard will now show all views in the correct size.
When you first create a storyboard you select a Device Family (iPhone or iPad) that the storyboard is targeted for. I don't know of a way to change the device family once the storyboard has already been created.
However, to solve your problem I recommend the following:
Create a new storyboard by going to: New -> File -> User Interface -> Storyboard (Be sure to select Device Family = iPad when choosing the options.)
Go to your old storyboard, select and copy everything by pressing Command-A, Command-C. Then go to your and paste everything by pressing Command-V. Your view controllers will now be iPad-sized.
You can then delete the old storyboard and rename your new storyboard to whatever the old name was.
This answer is not a solution, but will help to get one of the reasons why such things happen.
The issue occurs when you try to disable:
"Use Auto Layout"
When you uncheck it, the popup window appears. There is select:
"Keep size class data for: iPhone", by default is selected iPhone (no matter which iPad or iPhone project you created).
If you will not mention on it, your storyboard will be auto converted to iPhone sizes.
Do not forget to choose right device.
I used the suggested answer to convert an iPhone storyboard to an iPad storyboard and it worked great for most of my views. However, I realized that one of the views was still iPhone storyboard sized. The reason was because I had locked All Properties of one background image (because I did not want to accidentally move it). Removing the lock turned the view back into iPad sized. This might help someone stuck on this.
Make sure you set the right Storyboard in Target > General. This kinda stuff makes me headache for 3 hours before i realise i set the same storyboard for iPhone as my iPad storyboard.
In my universal app, I was using SpriteKit for the main viewcontroller. The SKScene.scaleMode was set to aspectFill. When run in the iPad simulator, the app started up iPhone mode. Solution was to set scaleMode = .resizeFill.
For me i have found it more easy by changing the view controller presentation to Full Screen rather than Automatic, I use Xcode 12.1

Resources