Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
466 views
in Technique[技术] by (71.8m points)

ios - Auto Layout proportionally Scaling Views

I have already found several questions and answers about this topic but I simply cannot get this to work for me.

Scaling

The blue rectangle is a UIView which contains the Test Label and Gear image button. The red one is a second UIView.

What I'd like to do is to get the blue bar (which is a UIView) increase in size for larger sized screens, which will result in the scaling of the Label and settings button, while the Red UIView shrink in height so the blue UIView can become larger. So basically the question is, how to proportionally scale the UIViews for different screen sizes.

I have tried using aspect ratio constraints, height constraints (greater than/less than) but I just can't get the desired effect.

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try proportional height and width. You need to make constraints for Equal Heights and/or equal Widths and then you double click on the constraint and change the multiplier for example 0.2 if you wish to make First Item to be 20% of second item in width and 2.0 for 200% (means double) in width. to make it increase or decrease proportionally according to your requiremententer image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...