简体   繁体   English

使用自动布局使任何视图的宽度等于屏幕宽度

[英]Use auto layout to have width of any view to be equal to the screen width

How can I make a view to have the width of the screen view. 如何使视图具有屏幕视图的宽度。 In Xcode 6 the default "Inferred" simulated metrics for the size is 600x600. 在Xcode 6中,默认的“推断的”大小模拟指标为600x600。 When I add the constraints for the view to have the width of the view to be equal to the width of the parent, it keeps the size 600px because I am guessing that it takes the size of the simulated metrics.... 当我为视图添加约束以使视图的宽度等于父视图的宽度时,它保持600px的大小,因为我猜测它采用了模拟指标的大小。

How can I have the width to be equal to the screen width? 如何使宽度等于屏幕宽度? Using "Width Equal" is obviously not an option here. 在这里显然不能使用“宽度等于”。 So, what should I do? 所以我该怎么做?

Thank you! 谢谢!

删除与宽度相关的任何其他约束,并将前导和尾随设置为0。

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

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