简体   繁体   English

约束不能正常工作,Xcode

[英]constraints not working properly, Xcode

what is the reason my constraints are off, i am running it on an iphone7 simulator and I can't get it right. 我的约束解除的原因是什么,我在iphone7模拟器上运行它,但无法正确执行。 Not sure what other information I can provide, all the details of my constraints are in the images. 不确定我可以提供什么其他信息,约束的所有详细信息都在图像中。

在此处输入图片说明

在此处输入图片说明 在此处输入图片说明

I suggest you use a button as the background. 我建议您使用按钮作为背景。 (The purple thing) And a plain UILabel as the text. (紫色的东西)和一个普通的UILabel作为文本。

The good side about this is that it will be very easy to position. 好的方面是,它很容易定位。

The bad side of this is that having the text color change when on press gets a bit more complicated. 不利的一面是,印刷时更改文本颜色会变得更加复杂。

But about your constraints, of the text labels. 但是关于您的约束,文本标签。 Check the property inspector and adjust the text alignment so that it's centered. 检查属性检查器并调整文本对齐方式,使其居中。

我突出显示了底部的所有4个按钮,并在一个时间点向它们添加了约束,并在“添加新的约束”选项卡中设置了相等的宽度和高度。

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

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