How do I define the size of a CollectionView on rotate

后端 未结 7 770
被撕碎了的回忆
被撕碎了的回忆 2020-12-04 15:26

I have a viewcontroller with 2 CollectionView Controllers.

I would like on rotation that only one of the collection views resize to a custom size while the other re

相关标签:
7条回答
  • 2020-12-04 16:26

    The question was , how to separate two collection views in sizeForItemAtIndexPath. Why just not something like this?

     func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
    
        if collectionView == firstCollectionView{
    
                return CGSize(width: self.frame.width/3, height: 40)
           }
    
    
        else if collectionView == secondCollectionView{
    
            return CGSize(width: self.frame.width, height: self.frame.height-2)
        }
    
        abort()
    }
    
    0 讨论(0)
提交回复
热议问题