I am using the AutoresizingMask to define relative positions programatically. I got almost everything working but I cannot figure out how to preserve the same separation between two elements (UIButton, UILabel are separated by 20px)
This is what I have:
UIButton, positioned at (100, 100), size: 60×30, autoresizingMask=UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin
UILabel, positioned at (180,100), size: 50×50, autoresizingMask=UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleLeftMargin
My problem is that I cannot maintain that 20px margin between these two elements when the orientation changes.
I’ve often found that I need to do a little more “adjustments” to my UI when changing orientations than what happens automatically.
You can add this routine to your controller, and fine-tune your UI the way you like: