//正确
collectionView = UICollectionView.init(frame: view.bounds, collectionViewLayout: layout)
//错误
collectionView = UICollectionView.init()
collectionView.frame = view.bounds
collectionView.collectionViewLayout = layout