I'm trying to create something that I thought would be easy using Auto Layout for iOS. I've been on this for days, bought a book, and tried various keyword search combinations. Anyone done this before and could point me in the right direction?
I want 3 UILabels, arranged in columns, with the middle one (which has more content) to be variable width depending on orientation of iPad.
I can get this to work, but once the iPad rotates from landscape to portrait (and therefore reduces the width available to the middle label) the middle label content gets cut off. i.e. the middle label height doesn't resize.
This is what I want to achieve:
Once you rotate to portrait:
Here are my constraints and View hierarchy:
If I give the middle UILabel a height constraint of 'less than or equal to' 250 (the height it needs to show all content in narrow portait mode), once the iPad orientates back to landscape the label content expands to fit the new width but also no longer aligns nicely with the tops of the other labels on either side.
Wrong vertical alignment
Here's my constraints on the middle label
(that Height equal 250 has a priority of 1, as it was a generated constraint that I cant get rid of.)
I've tried so many combinations of content hugging and compression resistance, I was sure that that would have been the answer, i.e. requiring the UILabel frame to hug the content. I obviously don't understand that as well as I should.