Top Banner
iOS Adaptive user interfaces
30

iOS Adaptive User Interfaces

Jul 01, 2015

Download

Engineering

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
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: iOS Adaptive User Interfaces

iOS Adaptive user interfaces

Page 2: iOS Adaptive User Interfaces

Agenda

• What is Adaptive layout ?

• Why Adaptive Layout ?

• Limitation

Page 3: iOS Adaptive User Interfaces

A step back…

Page 4: iOS Adaptive User Interfaces
Page 5: iOS Adaptive User Interfaces

Before iOS 8

• iPhone

• 320 x 480 pt (@1x.png, @2x png)

• 320 x 568 pt (@2x.png)

• iPad

• 768 x 1024 pt (@1x~ipad.png, @2x~ipad)

Page 6: iOS Adaptive User Interfaces
Page 7: iOS Adaptive User Interfaces

After iOS 8• iPhone

• 320 x 480 pt (@1x.png, @2x png)

• 320 x 568 pt (@2x.png)

• 375 x 667 pt (@2x.png)

• 414 x 736 pt (@3x.png)

• iPad

• 768 x 1024 pt (@1x~ipad.png, @2x~ipad)

Page 8: iOS Adaptive User Interfaces
Page 9: iOS Adaptive User Interfaces

What is Adaptive Layout?

Page 10: iOS Adaptive User Interfaces

What is Adaptive Layout?

• New default layout system for iOS 8

• Dynamically adapts UI to varying screen sizes

• Coupled with Auto-Layout

• Size Classes

Page 11: iOS Adaptive User Interfaces

How enable ?

Page 12: iOS Adaptive User Interfaces

Abstract representation of screen

Page 13: iOS Adaptive User Interfaces

Size Classes

• Regular and Compact

• Describe layout in terms of Horizontal and Vertical size

• Replaces UIInterfaceOrientation and UIInterfaceIdiom

Page 14: iOS Adaptive User Interfaces
Page 15: iOS Adaptive User Interfaces
Page 16: iOS Adaptive User Interfaces

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)

!

Page 17: iOS Adaptive User Interfaces

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

Page 18: iOS Adaptive User Interfaces

Why adaptive layout ?

Page 19: iOS Adaptive User Interfaces

Advantages

• Reduces amount of code

Page 20: iOS Adaptive User Interfaces
Page 21: iOS Adaptive User Interfaces

Advantages

• Reduces amount of code

• Layout on Storyboard

Page 22: iOS Adaptive User Interfaces
Page 23: iOS Adaptive User Interfaces

Advantages

• Reduces amount of code

• Layout on Storyboard

• Automatic rotation handling (in most cases)

• Universal Storyboard

• Allows to support wide range of screens

Page 24: iOS Adaptive User Interfaces
Page 25: iOS Adaptive User Interfaces

Assets library

• Allows separate versions of an image to be used per size class

Page 26: iOS Adaptive User Interfaces

Limitations

Page 27: iOS Adaptive User Interfaces

Not Size Classes aware• Most UI objects properties

• label color, button text, collection view layout attributes

• Properties of constraints

• priority

• multiplier

Page 28: iOS Adaptive User Interfaces

Warnings

• Check what Class is selected

• Xcode 5 will reset all Size Classes customization

• Commit Storyboard often

Page 29: iOS Adaptive User Interfaces

Q & A

Page 30: iOS Adaptive User Interfaces

Links• Gene Whitaker - Adaptive Layout http://www.bombingbrain.com/

demo/cocoaheads/AdaptiveLayout.pdf

• WWDC 2014 Session Videos:

• 216 - Building Adaptive Apps with UIKit

• 228 - A Look Inside Presentation Controllers

• 411 - What’s New in Interface Builder

• Adaptive User Interfaces http://developer.apple.com/design/adaptivity/