IOStickyHeader 1.0.4

IOStickyHeader 1.0.4

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2019年6月
SPM支持 SPM

Benjamin Prieur 维护。



  • Benjamin Prieur

我将CSStickyHeaderFlowLayout库(Obj-C)迁移到swift3.0

IOStickyHeader

CI Status Version License Platform

透视,固定的头部,渐增图片标题,一个UICollectionViewLayout中完成。

使用方法

要运行示例项目,克隆仓库,然后首先从Example目录运行 pod install

别忘了在Storyboard中将您的流布局与IOStickyHeader设置

使用代码将nib文件注册到collection view controller中

import IOStickyHeader

  let headerNib = UINib(nibName: "IOGrowHeader", bundle: NSBundle.mainBundle())
  override func viewDidLoad() {
      super.viewDidLoad()
        
      self.collectionView.registerNib(self.headerNib, forSupplementaryViewOfKind: IOStickyHeaderParallaxHeader, withReuseIdentifier: "header")
  }

实现 func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView

func collectionView(collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, atIndexPath indexPath: NSIndexPath) -> UICollectionReusableView {
    switch kind {
    case IOStickyHeaderParallaxHeader:
        let cell = collectionView.dequeueReusableSupplementaryViewOfKind(kind, withReuseIdentifier: "header", forIndexPath: indexPath) as! IOGrowHeader
        return cell
    default:
        assert(false, "Unexpected element kind")
    }
}

要求

  • Swift 4.2
  • iOS 9

安装

CococaPods

IOStickyHeader可以通过CocoaPods获取。要安装它,只需在您的Podfile中添加以下行

use_frameworks!
pod "IOStickyHeader"

Carthage

Carthage是一个去中心化的依赖管理器,构建您的依赖并提供您二进制框架。

您可以使用以下命令通过Homebrew安装Carthage

$ brew update
$ brew install carthage

使用Carthage将IOStickyHeader集成到您的Xcode项目中,在您的Cartfile中指定它

github "BenjaminPrieur/IOStickyHeader"

运行carthage update以构建框架,并将构建好的IOStickyHeader.framework拖入您的Xcode项目。

作者

Benjamin Prieur

许可协议

IOStickyHeader遵循MIT许可协议。更多信息请参阅LICENSE文件。