🧰 DequeueKit
DequeueKit 匹配注册 & 拉取 UITableViewCell, UICollectionViewCell
要求
- iOS 9.0 或更高版本
- Xcode 10.0 或更高版本
安装
在项目中使用 DequeueKit 有一个方法
- 使用 CocoaPods
CocoaPods 安装
pod 'DequeueKit', '1.3'
构建项目
在这种情况下,您的工作区应该可以无错误构建。如果您遇到问题,请在 Issue 中发布,社区可以帮助您解决问题。
如何使用
import DequeueKit
UITableView
使用 nib 注册
tableView.register(nib: YourTableViewCell.self)
使用类注册
tableView.register(class: YourTableViewCell.self)
使用类或 nib deque
let cell = tableView.dequeueReusableCell(type: YourTableViewCell.self, for: indexPath)
UICollectionView
Dequeue Reusable Cell
使用 nib 注册
collectionView.register(nib: YouCollectionViewCell.self)
使用类进行注册
collectionView.register(class: YouCollectionViewCell.self)
使用类或nib出队
let cell = collectionView.dequeueReusableCell(type: YourTableViewCell.self, for: indexPath)
出队可重复使用的补充视图
使用nib进行注册
collectionView.register(nib: YourHeaderView.self, of: .header)
collectionView.register(nib: YourFooterView.self, of: .footer)
使用类进行注册
collectionView.register(class: YourHeaderView.self, of: .header)
collectionView.register(class: YourFooterView.self, of: .footer)
使用类或nib出队
let headerView = collectionView.dequeueReusableSupplementaryView(type: YourHeaderView.self, of: .header, for: indexPath)
let footerView = collectionView.dequeueReusableSupplementaryView(type: YourFooterView.self, of: .footer, for: indexPath)
作者
通讯
许可证
所有源代码均使用MIT许可证许可。