I’ve looked around but haven’t found the answer to this question, so if it’s a duplicate, please point me to the original and I’ll delete. And I’m just beginning to work with autolayout, so if my question stems from a fundamental misunderstanding, please let me know!
I want, as the subject heading so cleverly indicates, to set something 2/3 of the way down the iPad screen, regardless of orientation. If I set it with points, say 250 points above the bottom in landscape view, then when it ends up 250 points above the bottom in portrait view it looks weird and too far down. But if I set it 400 points above the bottom in portrait view, then in landscape view it looks weird and too high up. Is there a way for me to set a constraint to “2/3 of the way down the screen” or other proportional distances like that?
Yes, you can do this by using the multiplier argument in the constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant: method. I think something like this should work. You’ll need an IBOutlet (conBottom in my example) that you connect to the constraint from the bottom of your label to the bottom of the view that was made in IB. You also need an IBOutlet to the label (myLabel in my example).
Note that you can only do this with constraints to the bottom or right side of the view, since the left and top would have 0 as their attribute value.