简体   繁体   中英

Stackview swift iPhone/iPad

Trying to use stackviews in my new app. This is how I want the app to look like. All UIViews are squares and scale with ratio 1:1. Labels should be placed just outside uiviews. Labeltext should also scale.

在此处输入图片说明

Tried to put the elements in stacks like this, but it is behaving weird. 在此处输入图片说明

How can I make the inner square (with the uiviews) as big as possible and make the labels float around the square?

I have attached the solution with UIView to be squares with aspect ration 1:1 and minimum/maximum value for labels

You can change the spacing of stackview containing labels programmatically to match the edges with square view of UIViews

Please check out the constraints of UIViews, relationships with other views (like equal widths/heights etc) distribution and spacing of stackviews

This checked this on iPhone 8/SE and iPad Pro and it viewed fine in Preview of storyboard except of the spacing of UILabels which can be set programmatically

The solution is uploaded to github here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM