xcode 6.1 iphone/ipad storyboard - ios

Trying to design iphone UI on xcode's new storyboard:
This seem's a little haphazard for designing just iphone UI.
I expected some form of 'iphone' 'ipad' 'extendable' boundaries or lines but all i can find is this one single storyboard. is it really just the single storyboard now or am i missing some additional controls?

Starting with XCode 6, the storyboards for the iPhone and iPad have been combined using a new feature called Size Classes. That's a good thing (most of the time), since it lets you design one interface that will adapt itself to different screen sizes.
Of course, there are situations where you may want to use different storyboards for the iPhone and iPad. After all, some apps just need a whole different approach on palm and tablet sized devices.
If you want to use the new Size Classes, see one of the growing number of tutorials, like this one by Ray Wenderlich: http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial.
If you would like to use separate storyboards for iPhone and iPad, here's how:
Start with a new Single View Application.
a. Select File|New|Project.
b. Select iOS, Application and click "Single View Application."
c. Click Next.
d. Give the project a name, then click "Next."
e. Pick a location and click "Create" to create the project.
Convert the starting storyboard to an iPhone storyboard.
a. Select Main.storyboard, and select the file inspector (the document icon at the top of the right pane) if it is not already selected.
b. Uncheck "Use Size Classes."
c. A dlialog will appear. Select "iPhone" from the drop down menu, then click "Disable Size Classes."
d. Rename the storyboard as "Main_iPhone.storyboard."
Create the iPad storyboard.
a. Select File|New|File from the menu bar. From the dialog that appears, select iOS|UserInterface. Click on "Storyboard" and click "Next."
b. Rename the file as "Main_iPad.storyboard," then save it, typically in the Base.lproj folder of your project folder.
c. Add a view controller, and make it the initial view controller by clicking the "Is Initial View Controller" check box in the Attributes Inspector pane.
Convert the new storyboard to an iPad storyboard by following the same steps as #2, above, but this time select iPad rather than iPhone when you select the platform.
Link the storyboards to the app.
a. Open the Info.plist.
b. Change the name for "Main storyboard file base name" from "Main" to "Main_iPhone.storyboard".
.c Add a new property called "Main storyboard file base name (iPad)" and give it the name "Main_iPad."
That's it! You can now create separate UIs for iPhone and iPad the way you always did.

In Utility Area select your storyboard
Show the Atributes inspector > Simulated Metrics > Size > Select Size

Related

Difference between view controller "use as launch screen" option and launch screen storyboard

I noticed there is a Use as Launch Screen option under File Inspector for a View Controller located in the Main.Storyboard. What is the difference between enabling the View Controller as a launch screen using this method and using the LaunchScreen.Storyboard that XCode provides? Similar questions are about the differences between Main.Storyboard and LaunchScreen.Storyboard but doesn't specifically ask about the Use as Launch Screen option.
The difference is that LaunchScreen.storyboard has this option enabled by default, but you can:
create your own separate storyboard with an initial view controller,
then select it as the launch screen for your app inside the project's settings (Project settings/General/App Icons and Launch Images/Launch Screen file),
...and it will also work in the same way.
Xcode only puts the launch screen in a different storyboard to preserve an organized view structure.

iPad is not present the "view as" section in the storyboard

iPad is not present in the size inspector of storyboard. This is the section located in the lower left side which can show you how the View Controller will look like on different size phones.
However it shows other devices. Can someone tell me how I can add iPad?
Find the xcodeproj file in the Project Navigator on the left side of the screen. Then Under Deployment Info -> Devices, pick Universal from the dropdown.

How do I change the preview device in Xcode storyboard?

As you can see from the below image
The storyboard preview is of some tablet device, I need to change this to the latest iphone or iphone 4s, how can I do this? Also I know about the assistant editor and how to preview on multiple devices using the assistant editor, thats not what I want, I want to change the preview in the story board itself
You need to follow four steps.
Press Cmd + Alt + Enter(return). It will show two window.
Click on 'Manual' text. It will show menu with Last option as 'Preview'.
Select it.
4.Select device type from bottom '+' button into which you want to see preview.
In Xcode 9.2, simply go to your Storyboard and go to the bottom, Click View As and choose a device you like.
Try this:
Select view controller > click on attribute inspector > select size you want.
select any viewController and then in attributes inspector tab you can change size.
You can open the utilities view and select the simulated size for the view controller
Utitilities View

Why are all my view controllers square shaped?

I'm trying to get it to be an iphone project, but when I drag any view controller into the storyboard, it's just a weird almost-square, neither ipad nor iphone. What am I doing wrong here? Newest version of XCode.
This is a new feature called "size classes". You can use it to create a universal storyboard for iPhone and iPad at once.
But I don`t really like it so here is how to turn off: In storyboard, open utility inspector (right), then go to file inspector (left) and now disable "Use Size Classes". Then you will get the standard storyboard.
You're not doing anything wrong. The default is to design with UI constraints so that the actual output size doesn't matter.
What you can do is set the size you want to preview your controller at in the options in the right hand pane. E.g.

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