Hacker News new | ask | show | jobs
by justinvoss 5248 days ago
The author may be overstating how rigid they are. iOS apps can be much less dynamic than web apps, mostly because you're working at a "lower" level in the GUI stack. Instead of having a layout engine that recalculates the positions of your UI elements for you (eg, HTML and the box model), you mostly have to manage the position and sizes of everything yourself.

You could create your own layout engine, but most developers choose not to, especially since the consistency of iOS hardware means they can predict screen sizes easily. Your other option is to make your app a thin wrapper around a Webkit view, but that tends to produce poor results (see the Netflix iOS app for an example).

2 comments

> Instead of having a layout engine that recalculates the positions of your UI elements for you (eg, HTML and the box model), you mostly have to manage the position and sizes of everything yourself.

I'm not sure that is strictly true. The autoresize model[1] will cover a lot of cases. The place where it does break down, and where HTML does shine, is with variable sized data such as paragraphs of text. However, that is starting to encroach on document territory anyway – meaning you'll probably want to use something like UIWebView to display that data.

Anyway, not trying to point out the obvious. I've just noticed that not all iOS devs are even aware of the autoresize functionality, so I figured it was worth noting.

[1] http://developer.apple.com/library/mac/#documentation/Cocoa/...

I'm definitely aware of the autoresize tools, but like you said, as soon as you start to have variable sized data it all sort of falls down. Then you wind up having to switch to using a UIWebView, which means redoing a lot of work. It can also be a huge headache to support both portrait and landscape mode with only the autoresize tools.
Interface builder (and now storyboards) have allowed WYSIWYG iOS interface layouts since 2008. There are definitely more dependencies and interrelation between a native app vs web app, but there is definitely a high-quality layout engine that makes basic formatting tasks easy.
The basics are definitely easy. A lot of apps need more than the basics; even changing between landscape and portrait can be tricky and more complex that a simple autoresizing mask can handle (I would know, since I'm neck-deep in developing an iPad app that needs this kind of complex layout and needs to support all orientations).