2016-04-22 7 views
1

私は同じような問題をどこにも見つけることができませんでしたので、私の最初の投稿です:私はiPhoneのための迅速な2つのプロジェクトに取り組んでいます。二サブビューの主「垂直」スタック図であり、だからスタックビューの自動制約違反、Swift 2、iOS 9.3、XCode 7

Layout showing bounds boxes and constraints

を等間隔:私は、埋め込まれたスタックビューで「設定」画面を考案したトップ一つで、カラーパレットの設定に対応します次の要素:

  1. 名前ラベル(「色相」)
  2. 色/ Bを切り替えるスイッチと、ウィンドウのメインラベル(「カラースキーム」)
  3. 色相(色合い)を変更するには、スライダー、 &名前ラベル(「カラー」)
  4. 名前ラベル(「レインボー」)
  5. 9つのサブビュー、各パレットカラーのための1つの水平スタックビューで、「レインボー」パレット対モノクロパレットを切り替えるためのスイッチを有するW、

ボトムビューは天気予報設定のためのもので、問題はありません。

横向きに肖像から変更する場合、主スタック・ビューが「水平」と「垂直」から変化するように設定されている:

Landscape orientation layout, showing all bounds boxes and constraints

ストーリーボードエディタは、(いずれかの方向に何ら制約エラーを示しませんすべてが青色で表示されます)、実行時にシミュレータで実行中に、画面の向きが横向きに変更されると、画面が完全に動作しても、複数の「制約を満たすことができません」というエラーが生成されます。

奇妙なことは、2回目のスタックビューで制約を破ることで回復しようとするたびに、制約エラーメッセージが何回か繰り返されることです。 (スタックビュー自体によって自動的に処理されるはずです)。特に、埋め込まれたサブビューの異なるペアの底部を等しい値に設定する複数の "等しい底部"制約を打ち破ろうとしています。つまり、2番目のスタックビュー内の9つのサブビューは、同じレベルで下限を持つことになっています(これはスタックビュー自体によって課されるので、プログラムでは変更できません)。システムがこれを試みるたびに失敗し、新しいエラーがコンソールに出力され、システムはスタックビュー内の別の "bottom == bottom"制約を破損させようとします。

これは、メインラベル(「カラースキーム」)の垂直サイズの制約を破ることによって解決するまで、数回(5〜8回)続きます。この最終結果を考慮して、メインラベルの垂直サイズの圧縮優先順位を変更しましたが、まだエラーが発生しています。ここでは、コンソール・ダンプです:

2016-04-22 10:06:14.061 Just Now[9468:534833] Unable to simultaneously satisfy constraints. 
    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. 
(
    "<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>", 
    "<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530)>", 
    "<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>", 
    "<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>", 
    "<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>", 
    "<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>", 
    "<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>", 
    "<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>", 
    "<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>", 
    "<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>", 
    "<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>", 
    "<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>", 
    "<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>", 
    "<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>", 
    "<NSLayoutConstraint:0x7fa91f41c650 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c67e0.bottom>", 
    "<NSLayoutConstraint:0x7fa91f417010 'UISV-alignment' UIView:0x7fa91f5c5850.top == UIView:0x7fa91f5c67e0.top>", 
    "<NSLayoutConstraint:0x7fa91f434df0 'UISV-canvas-connection' UIStackView:0x7fa91f5c6650.top == UIView:0x7fa91f5c5850.top>", 
    "<NSLayoutConstraint:0x7fa91f40dad0 'UISV-canvas-connection' V:[UIView:0x7fa91f5c5850]-(0)-| (Names: '|':UIStackView:0x7fa91f5c6650)>", 
    "<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>", 
    "<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0)>", 
    "<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>", 
    "<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>", 
    "<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fa91f41c650 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c67e0.bottom> 

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. 
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 
2016-04-22 10:06:14.063 Just Now[9468:534833] Unable to simultaneously satisfy constraints. 
    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. 
(
    "<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>", 
    "<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530)>", 
    "<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>", 
    "<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>", 
    "<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>", 
    "<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>", 
    "<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>", 
    "<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>", 
    "<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>", 
    "<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>", 
    "<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>", 
    "<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>", 
    "<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>", 
    "<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>", 
    "<NSLayoutConstraint:0x7fa921340700 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6970.bottom>", 
    "<NSLayoutConstraint:0x7fa91f417120 'UISV-alignment' UIView:0x7fa91f5c5850.top == UIView:0x7fa91f5c6970.top>", 
    "<NSLayoutConstraint:0x7fa91f434df0 'UISV-canvas-connection' UIStackView:0x7fa91f5c6650.top == UIView:0x7fa91f5c5850.top>", 
    "<NSLayoutConstraint:0x7fa91f40dad0 'UISV-canvas-connection' V:[UIView:0x7fa91f5c5850]-(0)-| (Names: '|':UIStackView:0x7fa91f5c6650)>", 
    "<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>", 
    "<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0)>", 
    "<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>", 
    "<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>", 
    "<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fa921340700 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6970.bottom> 

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. 
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 
2016-04-22 10:06:14.064 Just Now[9468:534833] Unable to simultaneously satisfy constraints. 
    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. 
(
    "<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>", 
    "<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530)>", 
    "<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>", 
    "<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>", 
    "<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>", 
    "<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>", 
    "<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>", 
    "<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>", 
    "<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>", 
    "<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>", 
    "<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>", 
    "<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>", 
    "<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>", 
    "<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>", 
    "<NSLayoutConstraint:0x7fa921340870 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6b00.bottom>", 
    "<NSLayoutConstraint:0x7fa91f4171f0 'UISV-alignment' UIView:0x7fa91f5c5850.top == UIView:0x7fa91f5c6b00.top>", 
    "<NSLayoutConstraint:0x7fa91f434df0 'UISV-canvas-connection' UIStackView:0x7fa91f5c6650.top == UIView:0x7fa91f5c5850.top>", 
    "<NSLayoutConstraint:0x7fa91f40dad0 'UISV-canvas-connection' V:[UIView:0x7fa91f5c5850]-(0)-| (Names: '|':UIStackView:0x7fa91f5c6650)>", 
    "<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>", 
    "<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0)>", 
    "<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>", 
    "<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>", 
    "<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fa921340870 'UISV-alignment' UIView:0x7fa91f5c5850.bottom == UIView:0x7fa91f5c6b00.bottom> 

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. 
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 
2016-04-22 10:06:14.065 Just Now[9468:534833] Unable to simultaneously satisfy constraints. 
    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. 
(
    "<_UILayoutSupportConstraint:0x7fa918c200e0 V:[_UILayoutGuide:0x7fa91f55acf0(44)]>", 
    "<_UILayoutSupportConstraint:0x7fa91f582a20 V:|-(0)-[_UILayoutGuide:0x7fa91f55acf0] (Names: '|':UIView:0x7fa91f53a530)>", 
    "<_UILayoutSupportConstraint:0x7fa91f5c65a0 V:[_UILayoutGuide:0x7fa91f5d2350(0)]>", 
    "<_UILayoutSupportConstraint:0x7fa918c11a20 _UILayoutGuide:0x7fa91f5d2350.bottom == UIView:0x7fa91f53a530.bottom>", 
    "<NSLayoutConstraint:0x7fa91f5d7bd0 V:[UISlider:0x7fa91f5d74e0(30)]>", 
    "<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]>", 
    "<NSLayoutConstraint:0x7fa91f5d49d0 V:[UISwitch:0x7fa91f5d4810(31)]>", 
    "<NSLayoutConstraint:0x7fa91f53e850 V:[UILabel:0x7fa91f511840'Hue'(21)]>", 
    "<NSLayoutConstraint:0x7fa91f539a00 V:|-(8)-[UILabel:0x7fa91f5c5c90'Color Scheme'] (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539af0 V:[UILabel:0x7fa91f5c5c90'Color Scheme']-(5)-[UILabel:0x7fa91f511840'Hue']>", 
    "<NSLayoutConstraint:0x7fa91f539b40 V:[UILabel:0x7fa91f511840'Hue']-(8)-[UISlider:0x7fa91f5d74e0]>", 
    "<NSLayoutConstraint:0x7fa91f539dc0 V:[UISwitch:0x7fa91f5d4810]-(19)-[UIStackView:0x7fa91f5c6650]>", 
    "<NSLayoutConstraint:0x7fa91f539e10 V:[UIStackView:0x7fa91f5c6650]-(8)-| (Names: '|':UIView:0x7fa91f5c5b00)>", 
    "<NSLayoutConstraint:0x7fa91f539f50 V:[UISlider:0x7fa91f5d74e0]-(37)-[UISwitch:0x7fa91f5d4810]>", 
    "<NSLayoutConstraint:0x7fa91f582f10 V:[_UILayoutGuide:0x7fa91f55acf0]-(0)-[UIStackView:0x7fa91f53a6a0]>", 
    "<NSLayoutConstraint:0x7fa91f582f60 V:[UIStackView:0x7fa91f53a6a0]-(0)-[_UILayoutGuide:0x7fa91f5d2350]>", 
    "<NSLayoutConstraint:0x7fa91ffc1160 'UISV-canvas-connection' UIStackView:0x7fa91f53a6a0.top == UIView:0x7fa91f5c5b00.top>", 
    "<NSLayoutConstraint:0x7fa9228831e0 'UISV-canvas-connection' V:[UIView:0x7fa91f53a830]-(0)-| (Names: '|':UIStackView:0x7fa91f53a6a0)>", 
    "<NSLayoutConstraint:0x7fa921301830 'UISV-fill-equally' UIView:0x7fa91f53a830.height == UIView:0x7fa91f5c5b00.height>", 
    "<NSLayoutConstraint:0x7fa91ffc15b0 'UISV-spacing' V:[UIView:0x7fa91f5c5b00]-(0)-[UIView:0x7fa91f53a830]>", 
    "<NSLayoutConstraint:0x7fa91ffb8540 'UIView-Encapsulated-Layout-Height' V:[UIView:0x7fa91f53a530(414)]>" 
) 

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x7fa91f5c5ef0 V:[UILabel:0x7fa91f5c5c90'Color Scheme'(32)]> 

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. 
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful. 

私は周りのものを移動しようとしているが、私は、ストーリーボードエディタでエラーを取得しないと、画面を回転させたときに、ランタイムエラーが継続します。スタックビュー内で自動制約を破りたいという事実は、これがバグかもしれないと私に思います。エラーにかかわらず、プログラムは動作し、それが想定されているように見えるので、私は迷っています。

ご協力いただければ幸いです。前もって感謝します!

答えて

1

私は誰もがこれを知っていたと思うので、私は何の答えも得られなかった。しかし、このエラーは解消され、Xcodeはもはや不平を言っていません。私はそれが戻った場合にフォローアップを投稿します。

関連する問題