Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use Auto layout or not iOS 6.x

I'm developing an app with Storyboard on iOS 6.1 (with many features - star ranking, sqlite DB, apple maps, etc..). Sometimes It happens that I have to disable the auto layout (for UIScrollView for example) or use code to work around the problem, but there are other examples. However when I disable it, I have to configure the UILabels with the exact width or other things.

What is the best option? Use auto layout or don't use it on iOS 6.x with Storyboard?

like image 317
Fabio Cardoso Avatar asked Mar 24 '13 01:03

Fabio Cardoso


3 Answers

Autolayout, like many other features added to ios in recent years (arc and storyboards, for instance) was designed to ease development for both people who're just getting started in the iOS/Mac platform or for people who are already there but don't come from the old days of NeXT or OS X's infancy and thus could use some simplification to the whole development workflow.

One thing you could do is use autolayout by default, therefore making easier to write ViewControllers that perform both in portrait and in landscape, and disable it on those rare ocassions where you're more comfortable keeping everything using the old system of springs and struts. Another thing you can do is to also add Autolayout constraints in code instead of through Xcode's Interface Builder, if that suits your style better.

My advice is to use whatever system makes you more comfortable, no matter what the current trend is.

like image 156
dinesharjani Avatar answered Dec 31 '22 19:12

dinesharjani


I don't use autolayout, because it's raw now. If you order constraints and then decide to move an element, you can get a real mess.

It's much safer to use springs and struts at this moment.

Upd.: But it's OK to use it in iOS7 - there are a lot of helpful tools for it in Xcode 5.

like image 36
Shmidt Avatar answered Dec 31 '22 19:12

Shmidt


Honestly, this is up to preference but I never use auto layout and I doubt that I ever will. I guess I just prefer everything being exactly how I specify it and I don't trust auto layout.

like image 21
Jsdodgers Avatar answered Dec 31 '22 18:12

Jsdodgers