简体   繁体   English

Xcode的约束问题

[英]Constraints Issue with Xcode

When I run the program in the simulator. 当我在模拟器中运行程序时。 It only show part of something. 它只显示部分内容。 Am I doing something wrong with my constraints? 我的约束条件有问题吗?

在此处输入图片说明

在此处输入图片说明

What ever the constraints you set are wrong to keep content in middle. 您设置的任何约束条件都是错误的,无法将内容保持在中间。 because take the 4s case in width 320 px you if you are giving left and right to 100px, So your play area will be only 120 (320 - 100 - 100). 因为如果您将左右像素设为100px,则以宽度为320 px的4s情况为例,因此您的游戏区域将仅为120(320-100-100)。 So if you want them aligned in middle you can add NSLayoutAttributeCenterX . 因此,如果希望它们在中间对齐,则可以添加NSLayoutAttributeCenterX Also when you add height, Top, Bottom constraints all your views are in relationship with its super view.. but view can also be in relationship with siblings. 同样,当您添加高度,顶部,底部约束时,所有视图都与其超级视图相关联。但是,视图也可以与同级对象相关联。

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

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