Size class specifically for portrait 3.5 inch (iPhone 4S) Xcode 6?

前端 未结 5 2151
遇见更好的自我
遇见更好的自我 2020-12-18 18:52

I\'m tuning my UI App, but I got an issue that I can\'t solve.

As I can see Compact height affects all iPhones under 4.7 inches, but my UI is fine except for the iPh

5条回答
  •  既然无缘
    2020-12-18 19:05

    An approach that just worked for me was to use the same constraints for all compact size classes but to use a combination of a greater than or equal to constraint and priorities to modify how the views were positioned on the iPhone 4's smaller screen.

    I've got a constraint between the top of a numeric keypad view and its superview that is set to be greater than or equal to 160 (with a priority of 1000) and a constraint between the bottom of the keypad view and the bottom of the superview that is set to a constant of 30 (but with a lower priority of 750).

    This means that on the iPhone 4 where there's not enough room for 160+ points above the keypad and 30 points below then it's the space below that goes.

    Whilst this approach may not work in all cases, I'd encourage you to think about whether there's a set of priorities that will allow your views to adjust in the way you want on the smaller screen.

提交回复
热议问题