简体   繁体   English

根据屏幕尺寸自动布局为“大于或等于”

[英]Autolayout with “greater than or equal to” based on screen size

I'm doing the screen onboarding for an app. 我正在为应用程序添加屏幕。 I did a lot of tests to adapt the three main elements (title, image and description) for all sizes (from iPhone 4 to iPhone 6 Plus), but in the end I gave up and I set the items for the iPhone 4. The result as you can see, all right on the iPhone 4 but going to climb on larger devices, the result is very bad. 我做了很多测试,以适应从iPhone 4到iPhone 6 Plus的所有尺寸的三个主要元素(标题,图像和说明),但是最后我放弃了,我为iPhone 4设置了项目。如您所见,在iPhone 4上可以正常使用,但要在较大的设备上爬升,结果非常糟糕。

在此处输入图片说明

My biggest problem is the constraints "greater than or equal to". 我最大的问题是约束“大于或等于”。 The ideal is to have the maximum and minimum vertical margins on labels that block the central image in case it becomes too large. 理想的做法是在标签上留出最大和最小的垂直边距,以防中央图像过大而阻塞中心图像。 Do you have any suggestions? 你有什么建议吗?

This is my current setup 这是我目前的设定

在此处输入图片说明

Thank You very much! 非常感谢你!

Hey i have added your sample project to a git repo and i have changed the constraints in such a way that whatever you needed to be in higher end devices for the screen. 嘿,我已将您的示例项目添加到git repo中,并且我以某种方式更改了约束,以使您需要在屏幕的高端设备中使用任何设备。 Take deep look at that and you can get idea to design any kind of screen with dynamic gaping and dynamic sizing without using size class. 仔细研究一下,您就可以在不使用尺寸类别的情况下设计出具有动态间隙和动态尺寸的任何类型的屏幕。 I am using proportional width and height constraints and dynamic blank views to manage gaps. 我正在使用成比例的宽度和高度约束以及动态的空白视图来管理间隙。

Here is the repo link. 这是回购链接。

https://github.com/mahesh-agrawal/Test-AutoLayout-Vertical-Gap.git https://github.com/mahesh-agrawal/Test-AutoLayout-Vertical-Gap.git

Thank you. 谢谢。

Set the proportional width constraint with SuperView. 使用SuperView设置比例宽度约束。

在此处输入图片说明

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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