Xcode 6.1 iphone / ipad storyboard

Trying to design iphone UI on the new xcode storyboard: enter image description here

enter image description here

This seems a bit random for designing only the iphone interface.

I was expecting some form of "iphone" "ipad" "extensible" borders or strings, but all I can find is one single storyboard. Is this really just one storyboard right now, or am I missing some extra controls?

+6
source share
2 answers

Starting with Xcode 6, storyboards for the iPhone and iPad have been merged using the new class class feature. This is a good thing (most of the time), because it allows you to create one interface that will adapt to different screen sizes.

Of course, there are situations when you can use different storyboards for iPhone and iPad. In the end, some applications need a completely different approach to devices on the palms and tablets.

If you want to use new dimension classes, see one of the growing number of tutorials such as Ray Wenderlich: http://www.raywenderlich.com/83276/beginning-adaptive-layout-tutorial .

If you want to use separate storyboards for iPhone and iPad, here's how:

  • Start with the new Single View app.

    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 initial 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." 

Uncheck Use Size Classes to convert to a device-specific storyboard.

  c. A dlialog will appear. Select "iPhone" from the drop down menu, then click "Disable Size Classes." 

Choose iPhone and click Disable Size Classes

  d. Rename the storyboard as "Main_iPhone.storyboard." 

enter image description here

  1. Create an 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." 

enter image description here

  b. Rename the file as "Main_iPad.storyboard," then save it, typically in the Base.lproj folder of your project folder. 

enter image description here

  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. 

enter image description here

  1. Convert the new storyboard to the iPad storyboard by following the same steps as # 2, but this time select the iPad and not the iPhone when you select the platform.

  2. 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." 

enter image description here

What is it! Now you can create separate user interfaces for the iPhone and iPad the way you always did.

+16
source

In the Utility area, select a storyboard

Show Atributes inspector > Simulated Metrics > Size > Select Size

+1
source

Source: https://habr.com/ru/post/977418/


All Articles