我的观点是这样的:
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的所有问题,但是没有一个能解决我的问题。
答案 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