private weak var parentViewController:UIViewController?;
private lazy var collectionView:UICollectionView= {[weak self] in/*弱引用*/
let layout = UICollectionViewFlowLayout();
layout.itemSize=(self?.bounds.size)!;
layout.minimumLineSpacing=0;
layout.minimumInteritemSpacing = 0;
layout.scrollDirection= .horizontal;
let collectionView =UICollectionView(frame:CGRect.zero,collectionViewLayout: layout);
collectionView.showsHorizontalScrollIndicator =false;//水平指示不显示
collectionView.isPagingEnabled=true;//分页显示
collectionView.bounces=false;//不超出内容的滚动
collectionView.dataSource=self;
collectionView.register(UICollectionViewCell.self,forCellWithReuseIdentifier:ContentCellID)
return collectionView;
}();
网友评论