简体   繁体   English

为iPhone和iPad Xcode 9指定不同的“查看”宽度

[英]Specify Different width to 'View' for iPhone and iPad Xcode 9

我有一个“视图”,没有为其添加任何宽度,并且在我指定了宽高比的情况下,它在不同的iPhone尺寸下都可以正常工作,但是当我切换到iPad时,“视图”会拉伸以占用iPad的整个空间指定iPad中“视图”的宽度,是否有人做过此事?

You need to disable the aspect ratio constraint for IPad and create a suitable one for it like this 您需要为iPad禁用宽高比约束,并为此创建一个合适的约束

1- Un install the aspect ratio constraint , click the + icon near installed from the popup select Regular for width and height , then click add variation 1-取消安装宽高比约束,从弹出窗口中单击安装旁的+图标,为宽度和高度选择常规,然后单击添加变化

在此处输入图片说明

2- And un Check it for RR 2-然后取消检查RR

在此处输入图片说明

3- Select any IPad device in the bottom Bar , click vary for traits and make the new aspect ratio constraint as you want then click Done varying 3-选择底部栏中的任何IPad设备,单击“ variant”以获得特征,并根据需要进行新的宽高比约束,然后单击“ Done changes” 在此处输入图片说明

By this you have 2 different constraints for the aspect ratio when you run the app in IPhone or Ipad , Note: you can do it for any constraint you want 这样,当您在IPhone或Ipad上运行应用程序时,您有2个不同的宽高比约束, 请注意:您可以针对所需的任何约束进行操作

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

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