Hacker News new | ask | show | jobs
by arange 4810 days ago
This article, although still great for beginners to get started, is using dated techniques that should be avoided.

In the past, developers would have resorted to starting with interface builder to do their designs. As they continued the development process, theyd notice that more and more of their views had to be done in code because Interface Builder wasn't powerful enough to do what they wanted. It could then be understandable why for newer projects, someone would skip Interface Builder altogether and go for code-only from the start.

Things have changed now though. Auto-Layout is extremely powerful in both Interface Builder and through code. Out of the box your visually designed interfaces now support powerful alignment and resizing irregardless of screen size. This is a big deal because there are a lot of screen sizes in iOS these days (iphone4, iphone5, ipad, all of these in landscape and portrait and yet again all these permutations with and without the keyboard open). auto-layout makes internationalization super easy too as all objects on your interface are designed to get bigger as words get longer (such as in German), yet have all associated objects around them still be perfectly aligned. Even right-to-left languages (and interface re-ordering) is supported without any additional code.

Looking at the code in the article, none of these are supported. If you even turn your iphone landscape the ui will be cut off. Let alone supporting ipad, keyboard open, longer words in the buttons/labels, etc.

I highly recommend new iOS developers to start with Auto-Layout from the getgo: https://developer.apple.com/library/mac/#documentation/UserE...

It's like tables vs css. Use CSS, it's much more portable.

2 comments

I seriously doubt you've made a complex app if you're recommending Auto Layout.
I hear this over and over again but don't understand why "complex" suddenly means "non-idiomatic UX." Most iOS apps follow common design patterns, and IB makes building these patterns extremely straightforward. For the one-off odd screens, sure, don't use IB, but certainly if you are building an iOS app the majority of screens will not require crazy unique UX. If they do that is probably a design smell.
Most iOS apps follow common design patterns.

Really? Every app I see in the top ten and every app clients want me to build for them is customized out the wazoo, with nary a stock control in sight. Most apps these days have highly dynamic content too, with elements resizing, moving around, and appearing and disappearing based on context. IB is worse than useless for this kind of UI and editing AutoLayout in IB should be considered cruel & unusual punishment.

Your parent meant "disirregardless" of couse :)