问题
I'm building a UI for a video player and trying to make sure it looks good on all devices (from iPad Pro down to iPhone SE)
Unfortunately I'm having trouble with the dynamic sizing of particular elements. Specifically the UISlider and UILabel. For this question specifically I've hidden the UILabel to focus on the UISlider.
Here is my setup in the Interface Builder in Xcode:
The relevant portion is the constraint:
Seek Bar.height = 0.1 x height
This should set the UISlider at the bottom of the UI to be exactly 1/10th of the full size of the View, regardless of screen size.
When I load this up on an iPad it looks fine. But when I load it up on an iPhone SE, I get the following:
The seek bar is HUGE! Nearly 1/4th the height of the entire View. What am I doing wrong? Am I misunderstanding something about how UISliders are sized?
来源:https://stackoverflow.com/questions/58013924/uislider-height-not-adjusting-correctly