简体   繁体   English

使用Xcode8在iOS10中自动布局无法正确显示

[英]AutoLayout can’t display correctly in iOS10 with Xcode8

I use autolayout in a project of mine.All the constraints are blue and it can display correctly in configuration bar.But when I run my project on Simulator the constraints are wrong and it can't display correctly.I am searching for a long time on net. 我在我的项目中使用自动布局,所有约束均为蓝色,并且可以在配置栏中正确显示,但是当我在Simulator上运行项目时,约束错误并且无法正确显示,我正在搜索很长时间在网上。 But no use. 但是没用。 Please help or try to give some ideas how to achieve this.I really want to know how to solve the problem.It makes me very annoyed.I hope someone can help me. 请帮忙或尝试提供一些解决方法,我真的很想知道如何解决这个问题,这让我非常恼火,希望有人可以帮助我。

Thank you very much! 非常感谢你!

(Picture2 is what displays in simulator.The last picture is the constraints.) (图2是模拟器中显示的内容。最后一张图是约束。)

图片2

这是我的限制

  • remove all current constrains from this view controller by clicking on issue icon -> clear constrains (in the second section) 通过单击问题图标->清除约束(在第二部分中),从此视图控制器中删除所有当前约束。
  • drag the items to the place you want on the view. 将项目拖到视图上所需的位置。
  • select an item 选择一个项目
  • open align -> set horizontally in container (current canvas value ) by clicking on the black arrow beside number 0 align menu Then set vertically in container (current canvas value) 单击数字0 对齐菜单旁边的黑色箭头,打开align->在容器中水平设置(当前画布值),然后在容器中垂直设置(当前画布值)
  • open Pin icon -> set value to width and set value to height pin menu 打开图钉图标->将值设置为宽度,并将值设置为高度图钉菜单
  • in the same pin menu check aspect ratio (in the second section ) 在相同的Pin菜单中检查纵横比(在第二部分中)

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

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