我在一个视图中有多个集合视图,并且在滚动和旋转屏幕时,某些单元格无法根据屏幕方向正确定向。
我尝试过的事情:
1。
override func viewdidlayoutsubviews() {
super.viewdidlayoutsubviews()
collectionView.collectionViewLayout.invalidateLayout()
}
2。
override func didRotate(from fromInterfaceOrientation: UIInterfaceOrientation) {
if let carousels = self.carouselViews {
for carousel in carousels {
carousel.collectionView.performBatchUpdates({
}) { (Bool) in
}
}
}
}