In Xcode 6, new feature called "Size classes" have been introduced. The size classes are used for making the storyboard compatible for all iOS Devices(iPhone & iPad, even iPod) in both portrait as well as Landscape orientations.
To set the size class:
1) Choose "Universal" option while creating the project.
2) Check the auto layout checkbox in Main.storyboard -> File Inspector -> "Use Auto Layout"
3) Check the size classes check box in Main.storyboard -> File Inspector -> "Use Size Classes".
There are two types of size classes:
Regular and Compact.
Hence the different configurations(screen sizes) include,
1) wAny hAny - Base configuration
2) wCompact hRegular - iPhone Portrait
3) wCompact hCompact - iPhone Landscape
4) wRegular wAny - iPad Landscape and portrait
On selecting the base configuration, the storyboard works the same in all devices. This can be viewed in "preview" option in the assistant editor on selecting the main.storyboard.
On selecting other configurations, the layout of the corresponding device changes based on the specifications set in that configuration.
To set the constraints by default, select the particular view( it may be label, image view or anything) and click the "Resolve Autolayout Issues" icon in the storyboard. Then, choose "Add missing constraints" which will add the necessary constraints needed for the auto layout.
IMAGE SIZES:
Also, three size resolution of images - 1x,2x,3x need to be added.
Create different versions of image in "asset catalog" and add the three images.
Comments
Post a Comment