容器视图在滚动视图中不滚动

问题描述 投票:0回答:1

我的视图堆栈是这样的。

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)

我搜索了所有关于滚动视图中容器视图的问题 但没有一个能解决我的问题。

ios swift uistoryboard ios-autolayout xcode-storyboard
1个回答
1
投票

我通过将嵌入式视图设置为 translatesAutoresizingMaskIntoConstraints = false 把它放在准备转场中

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

我的参考。在滚动视图中使用动态大小的控制器确定容器视图的大小

© www.soinside.com 2019 - 2024. All rights reserved.