13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

StackViewを使ってて、UISV-hidingやUISV-spacingといった制約が衝突するときの対処法

13
Posted at

StackViewを入れ子にしていて、子のStackViewをhiddenにすると次のようなログが出る。

	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. 
(
    "<NSLayoutConstraint:0x150ab6c10 'UISV-canvas-connection' UIStackView:0x150b9c8e0.top == UIView:0x150b9ca90.top>",
    "<NSLayoutConstraint:0x150ab33c0 'UISV-canvas-connection' V:[UIView:0x150b9cd80]-(0)-|   (Names: '|':UIStackView:0x150b9c8e0 )>",
    "<NSLayoutConstraint:0x150abb760 'UISV-hiding' V:[UIStackView:0x150b9c8e0(0)]>",
    "<NSLayoutConstraint:0x150ab2c40 'UISV-spacing' V:[UIView:0x150b9ca90]-(>=4)-[UIView:0x150b9cd80]>"
)

Will attempt to recover by breaking constraint 
<NSLayoutConstraint:0x150ab2c40 'UISV-spacing' V:[UIView:0x150b9ca90]-(>=4)-[UIView:0x150b9cd80]>

原因と対処法

子のStackViewをhiddenにして高さ0になったけど、中の要素が消えてないためspacingと衝突しているっぽい。中の要素をすべてhiddenにするとspacingがなくなって、なおる

13
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?