美文网首页
TableView 必须实现的方法

TableView 必须实现的方法

作者: whong736 | 来源:发表于2017-04-04 11:45 被阅读0次

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

}

相关文章

网友评论

      本文标题:TableView 必须实现的方法

      本文链接:https://www.haomeiwen.com/subject/pphqbttx.html