So, how you can see in pic below, i have collectionView and TableView in ScrollView. And it works not how i expected. You can see the problem in gif picture. The CollectionView has static height = 100 and tableview has selfsizeble height.StackView's height and width are equal to height and width of ScrollView. It looks like there is somewhere a tiny mistake, but i cant find it out.
here AutoSizeClass for TableView:
class AutoSizingTableView: UITableView {
override var intrinsicContentSize: CGSize {
self.layoutIfNeeded()
return CGSize(width: UIView.noIntrinsicMetric, height: contentSize.height)
}
override var contentSize: CGSize {
didSet{
self.invalidateIntrinsicContentSize()
}
}
override func reloadData() {
super.reloadData()
self.invalidateIntrinsicContentSize()
}
}
The problem is that View with Collection View staying in the same place and doesnt scroll up.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…