I've recently enabled Auto Layout in my client's app and am trying to update the program to take advantage of the iPhone 6 and 6 Plus larger screen sizes. However, I cannot get my view widths to adjust accordingly.
At the moment, I'm just concerned with getting the top two views correct. Here's what it looks like:
UILabel UITextField
The UILabel (called Name) has the following constraints:
- Leading Space to Superview: 27
- Top Space to Superview: 24
The UITextField's constraints:
- Leading Space to Name: 20
- Trailing Space to Superview: 27
- Align Center Y to Name
My hope was that this would position the left edge of the UITextField close to the Name label, and the right edge close to the right edge of the containing UIScrollView. However, while the left edge is correct, the UITextField is comically small, such that it could take no more than one or two characters.
If I add a constraint to the UITextField Width >= 156, the field is wide enough for the small iPhones, but doesn't stretch far enough for the larger ones. It seems to completely ignore the Trailing Space to Superview constraint I placed on the UITextField.
How can I get the UITextField to resize in accordance with the size of each device? Can I do it without resorting to code to change the constant of the Width constraint? Why is the Trailing Space to Superview constraint not respected?
Thanks for any assistance.