In a view controller, it's a bit harder to programmatically resize your UI elements, so that eg in landscape things are radically rearranged, and anything that can't be handled by the normal anchoring configurations.

If you subclass your view, it's easy: simply put the code in your 'layoutSubviews' method. But usually you don't have that, rather you've got your view controller class. Well the answer is to make a single method that does your resizing, and call it from three places, to ensure that it always gets called, otherwise you'll get strange edge cases where it doesn't get called. So put code like the following in your view controller:

Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.

Chris Hulbert

(Comp Sci, Hons - UTS)

Software Developer (Freelancer / Contractor) in Australia.

I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!

Get in touch:
[email protected]
github.com/chrishulbert
linkedin



 Subscribe via RSS