测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可 | MIT |
发布最后发布 | 2016年3月 |
SPM支持 SPM | ✗ |
由 Artur Jaworski 维护。
自动处理自定义 UITableViewCell 动态高度。用 Swift 编写。
TableViewAutolayoutManager 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中
pod "TableViewAutolayoutManager"
TableViewAutolayoutManager 继承自 TableViewManager。请首先查看 TableViewManager。
请确保您需要使用此 pod。在大多数情况下,自适应大小单元格就足够了。
TableViewAutolayoutManager 使用 UIView 的 systemLayoutSizeFittingSize(_:)
来计算高度。
执行在 TableViewManager 中描述的所有操作,但将 TableViewManager
替换为 TableViewAutolayoutManager
,并将 TableViewManagerProtocol
替换为 TableViewAutolayoutManagerProtocol
。
import TableViewAutolayoutManager
extension ViewController: TableViewAutolayoutManagerProtocol {
// (...)
}
按照以下方式实现 tableView(_:heightForRowAtIndexPath:)
。
extension ViewController: UITableViewDataSource, UITableViewDelegate {
func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
return self.tableViewAutolayoutManager(tableView, heightForRowAtIndexPath: indexPath)
}
// (...)
}
就这样!
TableViewAutolayoutManager 根据 MIT 许可证提供。有关更多信息,请参阅 LICENSE 文件。