Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is best Practices to use AutoLayout?

Since iOS7, I have been searching for standard GUI design pattern.

In my previous two apps, I unchecked autolayout and used autosizing.

It usually looks like this

enter image description here

Main View looks like below in SIZE INSPECTOR.

enter image description here

Currently I am making two xibs, iPhone4 iPhone5 and use UIViewAutoresizingFlexibleTopMargin & UIViewAutoresizingFlexibleLeftMargin along with -64 in iOS6/7 Delta.

For Inner/Child Views, I usually Keep UIViewAutoresizingFlexibleTopMargin and UIViewAutoresizingFlexibleLeftMargin and -64 in iOS6/7 Delta to work fine in iOS6.

enter image description here

It give almost perfect result, but sometime I need to start View from start of xib (0,0) but sometime from (64,0) to show Views look like starting from upper most border of View while running.

It makes me confused a lot to understand what is standard way to design XIB, so that we can use single XIB for iPhone4 and iPhone5 and on both platforms.

Thanks

like image 499
Chatar Veer Suthar Avatar asked Oct 01 '22 16:10

Chatar Veer Suthar


1 Answers

Personally, I find that using Interface Builder with AutoLayout is not very user friendly and that it quickly became messy.

I prefer do all AutoLayout stuff programmatically. To avoid lot of boilerplate, I use the Masonry library which is quite amazing.

like image 122
yageek Avatar answered Oct 12 '22 23:10

yageek