0

I have an IKImageBrowserView inside a NSScrollView.
I added Autolayout constraints to fix the top of the scroll view to the textfield above it and the bottom of the scroll view to the bottom of the window.

The desired behaviour is, that the scroll view (and the IKImageBrowserView with it) will grow and shrink vertically when you grow and shrink the window vertically.

The actual behaviour is, as soon as i added the constraints, the window is no longer vertically resizable.

Why is that? How can I achieve the desired behaviour?

4

1 回答 1

1

您可以通过执行以下操作检查约束:

NSArray* constraints = [window.contentView constraintsAffectingLayoutForOrientation:NSLayoutConstraintOrientationVertical];
NSLog(@"%@", constraints);

您也可以[window visualizeConstraints:constraints]进行交互式探索。

请参阅自动布局指南:解决自动布局问题 - 在代码中调试

于 2014-06-16T22:15:12.370 回答