MRTableViewCellCountScrollIndicator 0.0.6

MRTableViewCellCountScrollIndicator 0.0.6

测试已测试
Lang语言 SwiftSwift
许可证 MIT
Released最后发布Sep 2016
SPM支持 SPM

维护者:xtrinch.



  • 作者
  • Mojca Rojko

MRTableViewCellCountScrollIndicator

显示一个简单的 UITableView 滚动计数指示器。使用 Swift 2.2 编写。

示例

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

Moving content from under the keyboard in iOS / Swift

用法

创建一个 MRTableViewCellCountScrollIndicator 类,用您的 tableView 初始化它。类中有些变量可以更改,比如颜色、高度、透明度等,您可以根据需要更改它们,也可以使用默认值。您的 ViewController 仍然是 tableView 的 delegate 和 dataSource,因此您只需确保在从您的 API 获取后设置正确的项目数。

有关淡出效果,请参阅示例项目。

import MRTableViewCellCountScrollIndicator

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

    @IBOutlet weak var tableView: UITableView!
    var articles:[Article] = []
    var cellCounter:MRTableViewCellCountScrollIndicator?

    override func viewDidLoad() {
        super.viewDidLoad()
        tableView.delegate = self
        tableView.dataSource = self
        tableView.rowHeight = UITableViewAutomaticDimension
        cellCounter = MRTableViewCellCountScrollIndicator(tableView: tableView)
        cellCounter!.scrollCountView.mainBackgroundColor = UIColor.blueColor()
        cellCounter!.opacity = 0.7
        cellCounter!.rightOffset = 0
        fetchDataFromApi()
    }

    func fetchDataFromApi() {
      // fetch data
      cellCounter!.totalScrollCountNum = articles.count
      tableView.reloadData()
    }
}

安装

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

pod "MRTableViewCellCountScrollIndicator"

作者

xTrinch, [email protected]

许可证

MRTableViewCellCountScrollIndicator 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。