search

Home  >  Q&A  >  body text

ios9 - iOS客户端 淘宝 的个人主页布局

大家讲道理大家讲道理2892 days ago329

reply all(1)I'll reply

  • PHPz

    PHPz2017-04-18 09:33:15

    Are you asking about the layout?

    The layout of UICollectionView is simple
    You use the Command key to open the DataSource of UICollectionView
    There are various methods to set various parameters.
    A few are listed below. The first two public methods are required and optional are optional

    public protocol UICollectionViewDataSource : NSObjectProtocol {

    
    @available(iOS 6.0, *) //一个Section中有多少个单元格
    public func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int
    
    @available(iOS 6.0, *) //返回 单元格,你可以给单元格里放个image
    public func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell
    
    @available(iOS 6.0, *) //有几个 Section (可选,没有此方法,默认是1个)
    optional public func numberOfSectionsInCollectionView(collectionView: UICollectionView) -> Int
    /*
    dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath:
    */
    
    

    reply
    0
  • Cancelreply