SlideShare a Scribd company logo
1
Auto Layout
Presenter: Waseem Ahmad, Mindfire Solutions
Date: 04/03/2015
Today
Presenter: Waseem Ahmad, Mindfire Solutions
What is Autolayout?
Why do we need Autolayout?
Autolayout via StoryBoard.
Intrinsic Content Size.
Content Hugging & Content Resistance Priority.
Auto Layout Demo.
What is Autolayout?
• Setting UIView frames using rules rather than numbers. i.e No use of auto resizing
mask.
• We need to put some rules on the views in their place no matter what bounds are
available. We call these rules “constraints”.
• There is a very powerful API (NSLayoutConstraint) for doing this using code, but We
almost set up these rules in Xcode graphically i.e storyboard or xib.
• Today, we will discuss these rules using storyboard.
Presenter: Waseem Ahmad, Mindfire Solutions
Why do we need Autolayout?
Because many things affect the size of the area available to put views
•Multiple iOS versions (6, 7, 8, 9?)
•Screen sizes, iPhone 4, 4S, 5, 5S, 6, 6 Plus & iPad Variations
•To support autorotation (Portrait vs Landscape)
•Dynamic Content
•Localization
Presenter: Waseem Ahmad, Mindfire Solutions
Autolayout via storyboard?
The fundamental building block in Auto Layout is the constraint (rules).
Constraints express rules for the layout of elements in your interface and apply
attributes “left, right, top, bottom, leading, trailing, width, height, centerX, centerY,
and baseline” etc.
Presenter: Waseem Ahmad, Mindfire Solutions
How to apply Rules?
•Adding Constraints with Control-Drag
•Adding Constraints with Align and Pin Menus
Presenter: Waseem Ahmad, Mindfire Solutions
Intrinsic Content Size
The size of the view based on the content it display.
•For example, UILabel has a preferred height based on the font, and a preferred
width based on the font and the text it displays.
•A UIProgressView only has a preferred height based on its artwork, but no preferred
width.
•A plain UIView has neither a preferred width nor a preferred height.
Presenter: Waseem Ahmad, Mindfire Solutions
Intrinsic Content Size
•We do not want to add explicit width and hight constraints to a view that has an
intrinsic content size.
•At run time, infer size based on content, grow and resize dynamically.
•It depends on two constants per direction (horizontally, vertically)
• Content Hugging
• Content Resistance
Presenter: Waseem Ahmad, Mindfire Solutions
Content Hugging & Content
Resistance Priority
Content Hugging Priority
• High Value, don’t want to grow.
Content Resistance Priority
• High value fight to shrink, maintaining it’s intrinsic content size.
Presenter: Waseem Ahmad, Mindfire Solutions
Content Hugging & Content
Resistance Priority
•Both horizontal and vertical priorities (between 0 to 1000).
•Value doesn’t matter, you need to decide the priority between 2 items.
Presenter: Waseem Ahmad, Mindfire Solutions
Demo
• Login Screen
Presenter: Waseem Ahmad, Mindfire Solutions
Key principles for Auto Layout
•Think and define relationship between views and superview.
•Constraints must be sufficient and not conflict.
• Less try to use less magic numbers.
•Don’t over-specify constraints. Just say as little as possible to communicate the
layout and no more.
•Avoid letting IB define constraints for you. Unless your view is very simple, IB will
probably get it wrong.
•Mastering Autolayout is depend on experience and practice.
Presenter: Waseem Ahmad, Mindfire Solutions
References
- Apple WWDC 2013
- Apple WWDC 2014
- Apple Inc. “Autolayout Guide”.
- Standford Autolayout Demo “http://www.stanford.edu"
Presenter: Waseem Ahmad, Mindfire Solutions
Presenter: Waseem Ahmad, Mindfire Solutions
Question and Answer
Thank you
Presenter: Waseem Ahmad, Mindfire Solutions

More Related Content

Viewers also liked

View controllerp gforios
View controllerp gforiosView controllerp gforios
View controllerp gforios
Người Sói
 
Android picasso
Android picassoAndroid picasso
Android picasso
Zou Rongbo
 
iOSプログラミングでAutoLayoutを数式のように記述する
iOSプログラミングでAutoLayoutを数式のように記述するiOSプログラミングでAutoLayoutを数式のように記述する
iOSプログラミングでAutoLayoutを数式のように記述する
Hisakuni Fujimoto
 
Autolayout in iOS
Autolayout in iOSAutolayout in iOS
Autolayout in iOS
Singh Pushpendra
 
Autolayout primer
Autolayout primerAutolayout primer
Autolayout primer
Inferis
 
Autolayout
AutolayoutAutolayout
Autolayout
Jorge Ortiz
 
Autolayout keynote
Autolayout keynoteAutolayout keynote
Autolayout keynote
Li Lin
 

Viewers also liked (8)

Autolayout
AutolayoutAutolayout
Autolayout
 
View controllerp gforios
View controllerp gforiosView controllerp gforios
View controllerp gforios
 
Android picasso
Android picassoAndroid picasso
Android picasso
 
iOSプログラミングでAutoLayoutを数式のように記述する
iOSプログラミングでAutoLayoutを数式のように記述するiOSプログラミングでAutoLayoutを数式のように記述する
iOSプログラミングでAutoLayoutを数式のように記述する
 
Autolayout in iOS
Autolayout in iOSAutolayout in iOS
Autolayout in iOS
 
Autolayout primer
Autolayout primerAutolayout primer
Autolayout primer
 
Autolayout
AutolayoutAutolayout
Autolayout
 
Autolayout keynote
Autolayout keynoteAutolayout keynote
Autolayout keynote
 

Similar to Introduction to Auto-layout : iOS/Mac

Design Like a Pro: Building Mobile-Responsive HMIs in Ignition Perspective
Design Like a Pro: Building Mobile-Responsive HMIs in Ignition PerspectiveDesign Like a Pro: Building Mobile-Responsive HMIs in Ignition Perspective
Design Like a Pro: Building Mobile-Responsive HMIs in Ignition Perspective
Inductive Automation
 
Design responsively
Design responsivelyDesign responsively
Design responsively
Célia Leocádio
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
Zeeshan Khan
 
HTML and Responsive Design
HTML and Responsive Design HTML and Responsive Design
HTML and Responsive Design
Mindy McAdams
 
UX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentations
UX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentationsUX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentations
UX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentations
UX Alive Conference
 
Secrets of responsive web design by Sameera Thilakasiri
Secrets of responsive web design by Sameera ThilakasiriSecrets of responsive web design by Sameera Thilakasiri
Secrets of responsive web design by Sameera Thilakasiri
Sameera Thilakasiri
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive Website
Jj Jurgens
 
What are the Steps involved in Making WordPress.pptx
What are the Steps involved in Making WordPress.pptxWhat are the Steps involved in Making WordPress.pptx
What are the Steps involved in Making WordPress.pptx
Wordpress India
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
simonstarr
 
Xamarin 9/10 San Diego Meetup
Xamarin 9/10 San Diego MeetupXamarin 9/10 San Diego Meetup
Xamarin 9/10 San Diego Meetup
Seamgen
 
Responsive Web design Zambig
Responsive Web design ZambigResponsive Web design Zambig
Responsive Web design Zambig
Tribune Media
 
Responsive Web Design
Responsive Web Design Responsive Web Design
Responsive Web Design
CLEVER°FRANKE
 
Design4Drupal Boston 2013 - Bumps in the Road to Responsive
Design4Drupal Boston 2013 - Bumps in the Road to ResponsiveDesign4Drupal Boston 2013 - Bumps in the Road to Responsive
Design4Drupal Boston 2013 - Bumps in the Road to ResponsiveSalem Ghoweri
 
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin..."Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
Yandex
 
Responsive Web design _2013
Responsive Web design _2013 Responsive Web design _2013
Responsive Web design _2013 Suresh B
 
responsive web design 1_oct_2013
responsive web design  1_oct_2013 responsive web design  1_oct_2013
responsive web design 1_oct_2013
Suresh B
 
Rwd ppt
Rwd pptRwd ppt
Rwd ppt
Suresh B
 
responsive web design
responsive web designresponsive web design
responsive web designSuresh B
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
Steve Guinan
 
WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...
WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...
WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...
nois3
 

Similar to Introduction to Auto-layout : iOS/Mac (20)

Design Like a Pro: Building Mobile-Responsive HMIs in Ignition Perspective
Design Like a Pro: Building Mobile-Responsive HMIs in Ignition PerspectiveDesign Like a Pro: Building Mobile-Responsive HMIs in Ignition Perspective
Design Like a Pro: Building Mobile-Responsive HMIs in Ignition Perspective
 
Design responsively
Design responsivelyDesign responsively
Design responsively
 
Responsive web design
Responsive web designResponsive web design
Responsive web design
 
HTML and Responsive Design
HTML and Responsive Design HTML and Responsive Design
HTML and Responsive Design
 
UX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentations
UX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentationsUX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentations
UX Alive Conference speaker is Vitaly Friedman (Smashing Magazine) presentations
 
Secrets of responsive web design by Sameera Thilakasiri
Secrets of responsive web design by Sameera ThilakasiriSecrets of responsive web design by Sameera Thilakasiri
Secrets of responsive web design by Sameera Thilakasiri
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive Website
 
What are the Steps involved in Making WordPress.pptx
What are the Steps involved in Making WordPress.pptxWhat are the Steps involved in Making WordPress.pptx
What are the Steps involved in Making WordPress.pptx
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
Xamarin 9/10 San Diego Meetup
Xamarin 9/10 San Diego MeetupXamarin 9/10 San Diego Meetup
Xamarin 9/10 San Diego Meetup
 
Responsive Web design Zambig
Responsive Web design ZambigResponsive Web design Zambig
Responsive Web design Zambig
 
Responsive Web Design
Responsive Web Design Responsive Web Design
Responsive Web Design
 
Design4Drupal Boston 2013 - Bumps in the Road to Responsive
Design4Drupal Boston 2013 - Bumps in the Road to ResponsiveDesign4Drupal Boston 2013 - Bumps in the Road to Responsive
Design4Drupal Boston 2013 - Bumps in the Road to Responsive
 
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin..."Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
"Responsive Web Design: Clever Tips and Techniques". Vitaly Friedman, Smashin...
 
Responsive Web design _2013
Responsive Web design _2013 Responsive Web design _2013
Responsive Web design _2013
 
responsive web design 1_oct_2013
responsive web design  1_oct_2013 responsive web design  1_oct_2013
responsive web design 1_oct_2013
 
Rwd ppt
Rwd pptRwd ppt
Rwd ppt
 
responsive web design
responsive web designresponsive web design
responsive web design
 
Chapter 17: Responsive Web Design
Chapter 17: Responsive Web DesignChapter 17: Responsive Web Design
Chapter 17: Responsive Web Design
 
WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...
WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...
WUD Rome 2014 - Delightful UX – Real-Life Responsive Web Design (EN) - Vitaly...
 

More from Mindfire Solutions

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
Mindfire Solutions
 
diet management app
diet management appdiet management app
diet management app
Mindfire Solutions
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
Mindfire Solutions
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
Mindfire Solutions
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
Mindfire Solutions
 
ELMAH
ELMAHELMAH
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
Mindfire Solutions
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
Mindfire Solutions
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
Mindfire Solutions
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
Mindfire Solutions
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
Mindfire Solutions
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
Mindfire Solutions
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
Mindfire Solutions
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
Mindfire Solutions
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
Mindfire Solutions
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
Mindfire Solutions
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
Mindfire Solutions
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
Mindfire Solutions
 
Angular In Depth
Angular In DepthAngular In Depth
Angular In Depth
Mindfire Solutions
 
Django Models
Django ModelsDjango Models
Django Models
Mindfire Solutions
 

More from Mindfire Solutions (20)

Physician Search and Review
Physician Search and ReviewPhysician Search and Review
Physician Search and Review
 
diet management app
diet management appdiet management app
diet management app
 
Business Technology Solution
Business Technology SolutionBusiness Technology Solution
Business Technology Solution
 
Remote Health Monitoring
Remote Health MonitoringRemote Health Monitoring
Remote Health Monitoring
 
Influencer Marketing Solution
Influencer Marketing SolutionInfluencer Marketing Solution
Influencer Marketing Solution
 
ELMAH
ELMAHELMAH
ELMAH
 
High Availability of Azure Applications
High Availability of Azure ApplicationsHigh Availability of Azure Applications
High Availability of Azure Applications
 
IOT Hands On
IOT Hands OnIOT Hands On
IOT Hands On
 
Glimpse of Loops Vs Set
Glimpse of Loops Vs SetGlimpse of Loops Vs Set
Glimpse of Loops Vs Set
 
Oracle Sql Developer-Getting Started
Oracle Sql Developer-Getting StartedOracle Sql Developer-Getting Started
Oracle Sql Developer-Getting Started
 
LINQPad - utility Tool
LINQPad - utility ToolLINQPad - utility Tool
LINQPad - utility Tool
 
Get started with watch kit development
Get started with watch kit developmentGet started with watch kit development
Get started with watch kit development
 
Swift vs Objective-C
Swift vs Objective-CSwift vs Objective-C
Swift vs Objective-C
 
Material Design in Android
Material Design in AndroidMaterial Design in Android
Material Design in Android
 
Introduction to OData
Introduction to ODataIntroduction to OData
Introduction to OData
 
Ext js Part 2- MVC
Ext js Part 2- MVCExt js Part 2- MVC
Ext js Part 2- MVC
 
ExtJs Basic Part-1
ExtJs Basic Part-1ExtJs Basic Part-1
ExtJs Basic Part-1
 
Spring Security Introduction
Spring Security IntroductionSpring Security Introduction
Spring Security Introduction
 
Angular In Depth
Angular In DepthAngular In Depth
Angular In Depth
 
Django Models
Django ModelsDjango Models
Django Models
 

Recently uploaded

2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
wottaspaceseo
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 

Recently uploaded (20)

2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 

Introduction to Auto-layout : iOS/Mac

  • 1. 1 Auto Layout Presenter: Waseem Ahmad, Mindfire Solutions Date: 04/03/2015
  • 2. Today Presenter: Waseem Ahmad, Mindfire Solutions What is Autolayout? Why do we need Autolayout? Autolayout via StoryBoard. Intrinsic Content Size. Content Hugging & Content Resistance Priority. Auto Layout Demo.
  • 3. What is Autolayout? • Setting UIView frames using rules rather than numbers. i.e No use of auto resizing mask. • We need to put some rules on the views in their place no matter what bounds are available. We call these rules “constraints”. • There is a very powerful API (NSLayoutConstraint) for doing this using code, but We almost set up these rules in Xcode graphically i.e storyboard or xib. • Today, we will discuss these rules using storyboard. Presenter: Waseem Ahmad, Mindfire Solutions
  • 4. Why do we need Autolayout? Because many things affect the size of the area available to put views •Multiple iOS versions (6, 7, 8, 9?) •Screen sizes, iPhone 4, 4S, 5, 5S, 6, 6 Plus & iPad Variations •To support autorotation (Portrait vs Landscape) •Dynamic Content •Localization Presenter: Waseem Ahmad, Mindfire Solutions
  • 5. Autolayout via storyboard? The fundamental building block in Auto Layout is the constraint (rules). Constraints express rules for the layout of elements in your interface and apply attributes “left, right, top, bottom, leading, trailing, width, height, centerX, centerY, and baseline” etc. Presenter: Waseem Ahmad, Mindfire Solutions
  • 6. How to apply Rules? •Adding Constraints with Control-Drag •Adding Constraints with Align and Pin Menus Presenter: Waseem Ahmad, Mindfire Solutions
  • 7. Intrinsic Content Size The size of the view based on the content it display. •For example, UILabel has a preferred height based on the font, and a preferred width based on the font and the text it displays. •A UIProgressView only has a preferred height based on its artwork, but no preferred width. •A plain UIView has neither a preferred width nor a preferred height. Presenter: Waseem Ahmad, Mindfire Solutions
  • 8. Intrinsic Content Size •We do not want to add explicit width and hight constraints to a view that has an intrinsic content size. •At run time, infer size based on content, grow and resize dynamically. •It depends on two constants per direction (horizontally, vertically) • Content Hugging • Content Resistance Presenter: Waseem Ahmad, Mindfire Solutions
  • 9. Content Hugging & Content Resistance Priority Content Hugging Priority • High Value, don’t want to grow. Content Resistance Priority • High value fight to shrink, maintaining it’s intrinsic content size. Presenter: Waseem Ahmad, Mindfire Solutions
  • 10. Content Hugging & Content Resistance Priority •Both horizontal and vertical priorities (between 0 to 1000). •Value doesn’t matter, you need to decide the priority between 2 items. Presenter: Waseem Ahmad, Mindfire Solutions
  • 11. Demo • Login Screen Presenter: Waseem Ahmad, Mindfire Solutions
  • 12. Key principles for Auto Layout •Think and define relationship between views and superview. •Constraints must be sufficient and not conflict. • Less try to use less magic numbers. •Don’t over-specify constraints. Just say as little as possible to communicate the layout and no more. •Avoid letting IB define constraints for you. Unless your view is very simple, IB will probably get it wrong. •Mastering Autolayout is depend on experience and practice. Presenter: Waseem Ahmad, Mindfire Solutions
  • 13. References - Apple WWDC 2013 - Apple WWDC 2014 - Apple Inc. “Autolayout Guide”. - Standford Autolayout Demo “http://www.stanford.edu" Presenter: Waseem Ahmad, Mindfire Solutions
  • 14. Presenter: Waseem Ahmad, Mindfire Solutions Question and Answer
  • 15. Thank you Presenter: Waseem Ahmad, Mindfire Solutions