简体   繁体   English

如何使用约束修复此视图

[英]How to fix this view with constraints

Everyone. 大家。 I am new in swift, so I don't know how to fix this view with constraints. 我是swift的新手,所以我不知道如何用约束修复这个视图。 I used 'Add Missing Constrains' and 'Reset To Suggested Constrains' to this view and added each element custom constrain but I don't fix this view. 我在此视图中使用了“添加缺失约束”和“重置为建议的约束”并添加了每个元素自定义约束,但我不修复此视图。 Please, advise me. 请建议我。

(I have used any of any view) (我使用过任何一种观点)

my view: 我的观点:

视图

and rotated view: 和旋转视图:

旋转视图

The problem is that 'Add Missing constriants' and 'reset to Suggested constraints' work only in very specific cases. 问题是'添加缺失的constriants'和'重置建议的约束'只在非常具体的情况下工作。

This is a great tutorial for it - Part 1 - Part 2 这是一个很棒的教程 - 第1 部分 - 第2部分

I have fixed this view. 我修正了这个观点。 I added uiview and bottom uilabels added to this uiview so view like this: 我添加了uiview和底部uilabels添加到这个uiview所以这样看法:

在此输入图像描述

it worked perfect. 它完美无缺。 Thanks everyone 感谢大家

All your views need x,y co-ordinates and size(width and height). 您的所有视图都需要x,y坐标和大小(宽度和高度)。 So in your case the label should have leading and top constraints then intrinsic size as place holder. 因此,在您的情况下,标签应该具有前导和顶部约束,然后是内部尺寸作为占位符。 For the tick mark image right and top constraints are needed. 对于刻度线图像,需要右侧和顶部约束。

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

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