滚动视图内的容器视图不滚动

时间:2020-05-04 07:44:45

标签: ios swift uistoryboard ios-autolayout xcode-storyboard

我的观点是这样的:

superView
-scrollview = CONSTRAINTS(leading: superView, trailing: superView, top: superView, bottom: superView)
--view = CONSTRAINTS(leading: superView, trailing: superView, top: superView, bottom: superView, equalWidth: scrollView, equalHeight[priority: 250]: scrollView)
---collectionView = CONSTRAINTS(leading: view, trailing: view, top: view, height: 50)
---containerView = CONSTRAINTS(leading: view, trailing: view, top: collectionView, bottom: view)

我已经在scrollview中搜索了关于containerView的所有问题,但是没有一个能解决我的问题。

1 个答案:

答案 0 :(得分:1)

我设法通过将嵌入视图设置为translatesAutoresizingMaskIntoConstraints = false并将其放在prepareForSegue中来解决此问题

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
 segue.destination.view.translatesAutoresizingMaskIntoConstraints = false
}

我的参考:Sizing a Container View with a controller of dynamic size inside a scrollview