UICollectionViewController Error in Swift 3.0: must be initialized with a non-nil layout parameter

后端 未结 5 841
清酒与你
清酒与你 2021-01-14 08:03

I\'m new to iOS development. I\'ve been learning Swift, and today, I tried using UICollectionViewController.

My code is as follows:

 class ViewContro         


        
5条回答
  •  迷失自我
    2021-01-14 08:40

    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize {
        let cellSize = CGSize(width: 90, height: 120)
        //
        return CGSizeMake(cellSize)
    }
    
    func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAtIndex section: Int) -> UIEdgeInsets {
    
        return UIEdgeInsetsMake(top: 20, left: 10, bottom: 10, right: 10)
    }
    

提交回复
热议问题