• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

BenjaminPrieur/IOStickyHeader: Parallax and Sticky header done right using UICol ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

BenjaminPrieur/IOStickyHeader

开源软件地址:

https://github.com/BenjaminPrieur/IOStickyHeader

开源编程语言:

Swift 91.4%

开源软件介绍:

I migrated CSStickyHeaderFlowLayout library (Obj-C) to swift3.0

IOStickyHeader

CI Status Version License Platform

Parallax, Sticky Headers, Growing image heading, done right in one UICollectionViewLayout.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Don't forget to set your flow layout with IOStickyHeader in your storyboard

Register that nib file to your collection view controller in code:

import IOStickyHeader

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

Implement 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")
    }
}

Requirements

  • Swift 4.2
  • iOS 9

Installation

CococaPods

IOStickyHeader is available through CocoaPods. To install it, simply add the following line to your Podfile:

use_frameworks!
pod "IOStickyHeader"

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate IOStickyHeader into your Xcode project using Carthage, specify it in your Cartfile:

github "BenjaminPrieur/IOStickyHeader"

Run carthage update to build the framework and drag the built IOStickyHeader.framework into your Xcode project.

Author

Benjamin Prieur

License

IOStickyHeader is available under the MIT license. See the LICENSE file for more info.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap