ZoomyHeader 0.1.3

ZoomyHeader 0.1.3

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布日期上次发布2016年12月
SwiftSwift 版本3.0
SPM支持 SPM

Logan Sease 维护。



ZoomyHeader

Zoomy header 是一种将图像单元格添加到您的UITableView的方法,当您向上滚动时,它将缩小,类似于Twitter和其他应用程序。

用法


import ZoomyHeader

class ViewController: UITableViewController {

//keep a reference to the zoomyHeaderCell
private var imageViewCell : ZoomyHeaderCell?

override func viewDidLoad() {
    super.viewDidLoad()

    //register zoomyHeaderCell with your tableView
    ZoomyHeaderCell.registerZoomyCellIdentifier(tableView)
}

//MARK: TableView
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {

    //dequeue a zoomyheaderCell
    let identifier = "ZoomyHeaderCell"
    let cell = tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath)

    //set up our header cell with our image, keep our reference to it and tell the class its initial height
    if let imageCell = cell as? ZoomyHeaderCell
    {
        imageCell.fullImageView.image = UIImage(named: "city1.jpg")
        imageViewCell = imageCell
        imageCell.originalHeight = 300
    }
    return cell
}

//MARK: Scroll View Delegate

//Notify the header cell that it should adjust as the tableview scrolls
override func scrollViewDidScroll(scrollView: UIScrollView) {

    //if we are scrolling the tableview then adjust the scrollview frame accordingly
    if let tableview = scrollView as? UITableView, imageCell = imageViewCell
    {
        imageCell.didScroll(tableview)
    }
}

示例

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

要求

iOS 8+

安装

ZoomyHeader 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod "ZoomyHeader"

作者

Logan Sease,<[email protected]]

许可证

ZoomyHeader 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。