This presentation is about adaptive layout in iOS development. It describes the new layout system for iOS8, which dynamically adapts UI to varying screen sizes. Advantages and limitations of this layout are described in details.
Presentation by Yuriy Berdnikov (Team Lead, GlobalLogic, Lviv), delivered at GlobalLogic Lviv Mobile TechTalk, November 13, 2014.
More details -
http://www.globallogic.com.ua/press-releases/lviv-mobile-2014-coverage
10. What is Adaptive Layout?
• New default layout system for iOS 8
• Dynamically adapts UI to varying screen sizes
• Coupled with Auto-Layout
• Size Classes
13. Size Classes
• Regular and Compact
• Describe layout in terms of Horizontal and
Vertical size
• Replaces UIInterfaceOrientation and
UIInterfaceIdiom
14.
15.
16. Traits and TraitCollections
• Horizontal and vertical size class are identified as traits
• UITraitCollection Structure:
• Horizontal size class - Regular / Compact
• Vertical size class - Regular / Compact
• User interface idiom - iPhone / iPad / iPod Touch
• Display scale - 1.0 / 2.0
• Can be accessed to determine current size class (self.traitCollection)
!
17. Showing and Presenting
View Controllers
• Adaptively shows/presents view controllers appropriately based on
containing view controller/parent trait environment
• Examples:
• Navigation Controller
• SplitViewController
• Popovers
• Child view controllers do not need to be aware of their parent view controller to show or
present another view controller
• Use [self showViewController:animated:] instead of [self.navigationController
pushViewController:animated:]
• Use [self presentViewController:animated:] for popovers and action sheets
23. Advantages
• Reduces amount of code
• Layout on Storyboard
• Automatic rotation handling (in most cases)
• Universal Storyboard
• Allows to support wide range of screens
24.
25. Assets library
• Allows separate versions of an image
to be used per size class