Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also, calling -imageNamed to load your images will automatically cache the contents. Numerous Apple engineers have told me not to draw UIs in code and just to use images instead, so although it's a fun challenge, there really is no upside. Even animations in iOS like the jiggling/opening trash are just a series of PNGs using UIImageView animation.


there are plenty of upsides to drawing UIs in code. You get resizable controls, controls you can change the color on, controls that can be added easier programatically, and smaller app bundles.


> You get resizable controls

You also have that with images, so that does not apply.

You do get the rest, which has to be weighted against lower performances and higher maintainability costs.


> "You also have that with images, so that does not apply."

No, it very much still does. The only sort of resizing you get with images is whatever neatly fits within a 9-patch.

Which is to say, if your center patch is non-uniform (gradient? textured surface?) you lose resizability.

So yes, if you design a very standard UI that sails very close to the default iOS look and feel, you will be using stretchable images for almost everything. Which is to say, single-line elements that do not resize vertically at all, vertical linear gradients as an aesthetic theme instead of texturing (which is becoming a thing now), etc.

The moment you depart those shores though, images start becoming a liability instead of an asset, and you'll need to do a lot more custom work to get your widgets to resize properly.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: