iOS版6.0自动版式问题与制约因素:在旋转时子视图消失 [英] iOS 6.0 AutoLayout issue with constraints: subviews disappear when rotated

查看:143
本文介绍了iOS版6.0自动版式问题与制约因素:在旋转时子视图消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我已经设计了自动版式使用以制约性按钮显示两排,每排三个按钮的厦门国际银行,如截图所示(我将放在红UIViews按钮后,我得到一个满意的布局):

Hi I have designed a XIB using AutoLayout constriants to display two rows of buttons, with three buttons in each row, as shown in the screenshot (I'll place the buttons in the Red UIViews after I get a satisfactory layout):

如上图所示的按钮看起来不错到目前为止好,在纵向模式下。然而,当我旋转为横向头(蓝色)和父视图(灰色)调整和正确显示,但红色按钮的观点只是消失(见下文)。

So far so good, in portrait mode as shown above the buttons look fine. However when I rotate to landscape the header (in blue) and parent view (in grey) resize and appear correctly, but the red button views just disappear (see below).

什么是设置约束上得到这个工作的权利的最佳途径?我也跟着雷Wenderlich教程,并使用相同的编辑\\密码]垂直间距和Editor \\销\\,他在他的例子使用水平间距:
       雷Wenderlich教程

What is the best way to set the contraints to get this to work right? I have followed the Ray Wenderlich tutorial and used the same Editor\Pin]Vertical Spacing and Editor\Pin\Horizontal spacing that he uses in his example: Ray Wenderlich tutorial

我也得到了很多的约束错误的,如如下:

I also get a lot of constraint errors such as the follows:

        Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints) 
(
    "<NSLayoutConstraint:0x859abe0 UIView:0x85a8fb0.height == UIView:0x85a8e60.height>",
    "<NSLayoutConstraint:0x859ab60 V:[UIView:0x85a8fb0]-(114)-|   (Names: '|':UIView:0x85a8170 )>",
    "<NSLayoutConstraint:0x859ab20 V:|-(424)-[UIView:0x85a8fb0]   (Names: '|':UIView:0x85a8170 )>",
    "<NSLayoutConstraint:0x85a3430 V:|-(150)-[UIView:0x85a8170]   (Names: '|':UIView:0x85a8da0 )>",
    "<NSLayoutConstraint:0x85a33b0 V:[UIView:0x85a8170]-(NSSpace(20))-|   (Names: '|':UIView:0x85a8da0 )>",
    "<NSAutoresizingMaskLayoutConstraint:0x75ac610 h=--& v=--& V:[UIView:0x85a8da0(704)]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x859ab60 V:[UIView:0x85a8fb0]-(114)-|   (Names: '|':UIView:0x85a8170 )>

Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.

我在我的智慧这样结束,所以从这个博学组中的任何帮助将是最AP preciated ...!

I'm at my wits end with this, so any help from this erudite group would be most appreciated...!

推荐答案

该错误意味着你有冲突的约束。设法得到它工作了一排。

The error means you have conflicting constraints. Try to get it working for one row.


  1. 脚的每一个红盒子与垂直间距为蓝色标题框

  2. 引脚左侧的红色框的领先空间,上海华

  3. 销权红框后面有个空格,以上海华

  4. 设置水平间距为中心的红色框的左侧和右侧

  5. 修正的高度

  6. 选择所有三个红色框和(平均宽度)将它们设置为具有相等宽度

  7. 删除任何无关的由IB添加的约束

  8. 在设备上
  9. 测试。 (我模拟横向/纵向)在Interface Builder有时会改变的约束。
    9它应该看起来像所附图片

这篇关于iOS版6.0自动版式问题与制约因素:在旋转时子视图消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆