3 ms·
While learning how to do this stuff in code is a good exercise, it's much better to do these things in IB when possible. Here's the same app done in IB: http:/
by M4v3R 14y ago
While learning how to do this stuff in code is a good exercise, it's much better to do these things in IB when possible. Here's the same app done in IB:
http://dl.dropbox.com/u/1127246/Screenshots/op4t.png http://dl.dropbox.com/u/1127246/Screenshots/op4t.png
This is it, that's the whole app (there is also an AppDelegate which I didn't even open and contains virtually no code). There are literally 3 lines of code written by me here (compared by 40-50 lines in the article). Everything else is generated/hooked up in the NIB by Interface Builder. This was done in about 2-3 minutes.
In fact, this code performs better than the one from the article, because it uses Auto Layout. So when you rotate the device, you get a desired outcome:
http://dl.dropbox.com/u/1127246/Screenshots/rulo.png http://dl.dropbox.com/u/1127246/Screenshots/rulo.png
If you do the same with the app from the article, you'll see this:
http://dl.dropbox.com/u/1127246/Screenshots/sncv.png http://dl.dropbox.com/u/1127246/Screenshots/sncv.png
And then you'll have to write another bunch of code in layoutSubviews method, or manually create struts and strings or constraints.