Sections
func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int {
return1
}
/**
- returns: Section中Item的个数
*/
func collectionView(collectionView: UICollectionView, numberOfItemsInSectionsection: Int) -> Int {
return8
}
/**
- returns: 绘制collectionView的cell
*/
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPathindexPath: NSIndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCellWithReuseIdentifier("MyCell",forIndexPath: indexPath) as! CollectionViewCell
cell.imageView.image= UIImage(named:"\(indexPath.row + 2).png")
cell.label.text="美景\(indexPath.row + 1)"
returncell
}