项目作者: maximeal10

项目描述 :
Table View with sticky cells
高级语言: Swift
项目地址: git://github.com/maximeal10/StickyCells.git
创建时间: 2020-09-14T12:48:49Z
项目社区:https://github.com/maximeal10/StickyCells

开源协议:MIT License

下载


StickyCells

Allows to set several levels of stickied cells

Farmers Market Finder Demo

Usage

  1. import StickyCells

You have to use StickyCellsTableView and inherit cell class from StickyCellWith<StickyView: UIView> where StickyView is actual view that will be displayed in table

  1. class MyStickyCell: StickyCellWith<Label> {}

then, in dequeueReusableCell(withIdentifier identifier: String, for indexPath: IndexPath) -> UITableViewCell method, call setLevel(_ level: Int?) on sticky cells

  1. func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  2. let cell = tableView.dequeueReusableCell(withIdentifier: reuseIdentifier, for: indexPath)
  3. if let stickyCell = cell as? MyStickyCell {
  4. stickyCell.stickyView.text = "I'm a sticky cell"
  5. stickyCell.setLevel(0)
  6. }
  7. return cell
  8. }

Look at example app source for details

Install

CocoaPods

  1. target 'YOUR_TARGET' do
  2. # Comment the next line if you don't want to use dynamic frameworks
  3. use_frameworks!
  4. pod 'StickyCells'
  5. end