简体   繁体   English

根据电话调整UIScrollView内UIView和UIButton之间的约束高度

[英]adjust constraint height between UIView and UIButton inside UIScrollView based on phone

Unfortunately, I've added UIScrollView for that Controller because of Content height will be long for small phone such as iPhoneSE and so on. 不幸的是,我为该Controller添加了UIScrollView ,因为对于iPhoneSE等小型手机而言,内容高度会很长。

在此处输入图片说明

You will see there is two constraints between UIView and UIButton . 您将看到UIViewUIButton之间有两个约束。 One is first priority set 1000 and relation is Less Than or Equal . 一个是第一优先级集1000并且关系Less Than or Equal Another dotted constraint is second priority set 999 and relation is Equal . 另一个虚线约束是第二优先级集999 ,关系是Equal But that's working smoothly for iPhone 6 onwards. 但这对于iPhone 6及更高版本来说一直很顺利。 Unfortunately, for iPhoneSE and 5s that gap is awful as two button are under fold. 不幸的是,对于iPhoneSE和5s,由于两个按钮处于折叠状态,因此差距非常大。 Please let me know how to adjust that constraint for small phone? 请让我知道如何针对小型电话调整该限制?

Hi yo can achieve your needs as described constraints in attached image. 嗨,您可以按照所附图像中描述的约束来满足您的需求。

1. You will need to apply on bottom button.

Add same value as bottom constraints with ScrollView and Main screen's super view (UIView). 使用ScrollViewMain屏幕的超级视图(UIView)添加与底部约束相同的值。 As you can see there is applied two bottom constraints over red Button. 如您所见,红色按钮上有两个底部约束。 (*In attached screenshots) (*在所附的屏幕截图中)

Where, One of as bottom constraint on ScrollView (With value = 10) and another one is bottom constraint on Controller's Main View (With same value = 10) 其中,ScrollView的底部约束之一(值为10),Controller主视图的底部约束之一(相同值为10)

Please have a look into attached image. 请看附件图片。

在此处输入图片说明

在此处输入图片说明

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

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