iOS landscape mode & positioning elements

This is a documented note to myself and to others who might be pulling their hair out a little when working with a landscape orientation in iOS.

I was working in landscape mode (only) and I was positioning things around based on frame origins, and I was finding my placements were off. To get into landscape, auto resizing masking is applied to the view(s). However in viewDidLoad is too early to count on anything to base calculations upon. Use viewDidAppear¬†instead. viewWillAppear is also too soon. I forgot about this method since I almost never seem to need it and it’s not part of the default Xcode template for a view controller. I spent nearly an hour wondering what the hell was going on – simple math right? How can it be off like that?

My doh moment for this Friday. I can’t stand when I miss things like this and just piddle coding time away chasing something so rudimentary.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *

2 × one =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>