我的视图堆栈是这样的。
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)
我搜索了所有关于滚动视图中容器视图的问题 但没有一个能解决我的问题。
我通过将嵌入式视图设置为 translatesAutoresizingMaskIntoConstraints = false
把它放在准备转场中
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
segue.destination.view.translatesAutoresizingMaskIntoConstraints = false
}