【问题标题】:Putting a UIViewController in a XIB makes constraints disagree with frame将 UIViewController 放在 XIB 中会使约束与框架不一致
【发布时间】:2014-12-06 03:47:00
【问题描述】:

UIViewController 的view 出口的直接子级在约束空间中具有奇怪的 16pt 水平填充,但在框架空间中没有。

  1. 在 Xcode 6 中将 UIViewController 添加到 XIB 文件
  2. 在 UIViewController 的view 中添加子视图
  3. 拉伸子视图,使其前缘和后缘接触父视图
  4. 单击固定约束按钮
  5. 观察到 IB 想要添加从子视图到其父视图的 -16pt 距离

这种差异来自哪里?如何让我的子视图保持在父视图的边缘?

【问题讨论】:

    标签: ios xcode uiviewcontroller interface-builder xib


    【解决方案1】:

    在 pin 约束弹出框中,取消选中“Constrain to margins”。

    这里有更多关于这个功能的讨论:What is "Constrain to margin" in Storyboard in Xcode 6

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-28
      • 1970-01-01
      • 1970-01-01
      • 2011-07-23
      • 2012-02-04
      • 1970-01-01
      • 1970-01-01
      • 2016-08-06
      相关资源
      最近更新 更多