测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布日期上次发布 | 2016年12月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Logan Sease 维护。
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 文件。