TableView 必须实现的方法

2017-04-04  本文已影响0人  whong736

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

}

上一篇 下一篇

猜你喜欢

热点阅读