All Projects → liangdahong → Uitableviewdynamiclayoutcacheheight

liangdahong / Uitableviewdynamiclayoutcacheheight

Licence: mit
🖖高性能的自动计算采用 Autolayout 布局的 UITableViewCell 和 UITableViewHeaderFooterView 的高度,内部自动管理高度缓存。

Projects that are alternatives of or similar to Uitableviewdynamiclayoutcacheheight

Mylinearlayout
MyLayout is a powerful iOS UI framework implemented by Objective-C. It integrates the functions with Android Layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,PathLayout,GridLayout,LayoutSizeClass to build your App 自动布局 UIView UITab…
Stars: ✭ 4,152 (+1053.33%)
Mutual labels:  autolayout, uicollectionview, uitableview
Gltablecollectionview
Netflix and App Store like UITableView with UICollectionView, written in pure Swift 4.2
Stars: ✭ 709 (+96.94%)
Mutual labels:  uicollectionview, uitableview, uitableviewcell
ios ui recipe showcase
iOSアプリ開発 - UI実装であると嬉しいレシピブック掲載サンプル
Stars: ✭ 54 (-85%)
Mutual labels:  uitableview, uicollectionview, autolayout
Automatic Height Tagcells
This is a sample project to implement features with dynamic height of UITableViewCell based on autolayout, tags aligned automatically and clickable tags.
Stars: ✭ 229 (-36.39%)
Mutual labels:  autolayout, uitableview, uitableviewcell
Basecomponents
BaseComponents aims to provide easily reusable and understandable components to increase productivity with UIKit and Foundation APIs
Stars: ✭ 92 (-74.44%)
Mutual labels:  autolayout, uicollectionview, uitableview
Tablekit
Type-safe declarative table views.
Stars: ✭ 567 (+57.5%)
Mutual labels:  autolayout, uitableview, uitableviewcell
Expandabletable
AZExpandable is a lightweight proxy for UITableView to expand cells.
Stars: ✭ 218 (-39.44%)
Mutual labels:  uitableview, cell, uitableviewcell
Tangramkit
TangramKit is a powerful iOS UI framework implemented by Swift. It integrates the functions with Android layout,iOS AutoLayout,SizeClass, HTML CSS float and flexbox and bootstrap. So you can use LinearLayout,RelativeLayout,FrameLayout,TableLayout,FlowLayout,FloatLayout,LayoutSizeClass to build your App 自动布局 UIView UITableView UICollectionView
Stars: ✭ 984 (+173.33%)
Mutual labels:  autolayout, uicollectionview, uitableview
Flowkit
A declarative type-safe framework for building fast and flexible list with Tables & Collection
Stars: ✭ 215 (-40.28%)
Mutual labels:  autolayout, uicollectionview, uitableview
Multiple-collectionView-in-Multiple-tableView-cells
UICollectionView is embed in UITableViewCell. The collection views are horizontal scrollable. The UITableView can have a section title for each UICollectionView and the number of UICollectionView is equal to the number of sections.
Stars: ✭ 23 (-93.61%)
Mutual labels:  uitableview, uitableviewcell, cell
TableViewKit
Empowering UITableView with painless multi-type cell support and built-in automatic state transition animations
Stars: ✭ 105 (-70.83%)
Mutual labels:  uitableview, uitableviewcell
Transfiguration
Mystical way to transform data into reusable view in Swift
Stars: ✭ 14 (-96.11%)
Mutual labels:  uitableview, uicollectionview
WBChainMenu
This will show horizontal menu to a UITableViewCell with chain animation
Stars: ✭ 28 (-92.22%)
Mutual labels:  uitableview, uitableviewcell
UITableViewCellAnimation
Basic tabeview cell animation for best way to display cell
Stars: ✭ 31 (-91.39%)
Mutual labels:  uitableview, uitableviewcell
XLRefresh
iOS 下拉刷新工具
Stars: ✭ 25 (-93.06%)
Mutual labels:  uitableview, uicollectionview
GenericCells
Creating generic UITableViewCells and UICollectionViewCells instead of subclasses.
Stars: ✭ 81 (-77.5%)
Mutual labels:  uitableview, uicollectionview
MultiSelect
swift
Stars: ✭ 12 (-96.67%)
Mutual labels:  uitableview, uicollectionview
tcscustomrowactionfactory
TCSTableViewRowActionFactory allows you to setup the swipe actions for cells in a table view using UIView and some other convenient methods
Stars: ✭ 24 (-93.33%)
Mutual labels:  uitableviewcell, cell
TinyCoordinator
The Swift version of ThinningCoordinator focus on lighter view controllers.
Stars: ✭ 18 (-95%)
Mutual labels:  uitableview, uicollectionview
CollectionAndTableViewCompatible
A set of Swift protocols and Xcode snippets that will make it easy to do clean UITableView code
Stars: ✭ 34 (-90.56%)
Mutual labels:  uitableview, uicollectionview

介绍

  • UITableViewDynamicLayoutCacheHeight 是一个便捷的,高性能的自动计算使用 Autolayout 布局【XibStoryBoardMasonrySnapKitSDAutoLayout ...】的 UITableViewCellUITableViewHeaderFooterView 的高度,支持横竖屏,内部自动管理高度缓存,已兼容 Swift 。

CocoaPods 安装

pod 'UITableViewDynamicLayoutCacheHeight'
pod install
#import <UITableViewDynamicLayoutCacheHeight/UITableViewDynamicLayoutCacheHeight.h>
  • 如果只想使用免注册获取 Cell 和 UITableViewHeaderFooterView 可使用如下的 pod
pod 'UITableViewDynamicLayoutCacheHeight/Category'

手动安装

  • 下载项目 【 clone https://github.com/liangdahong/UITableViewDynamicLayoutCacheHeight.git
  • UITableViewDynamicLayoutCacheHeight 文件夹下的全部内容拖拽到你的项目。

图文使用说明

Cell 使用 Xib 构建 「 也支持纯代码布局,只要是使用 Autolayout 均可 」

  • 创建你的 Cell 且使用约束布局, 保证【 Cell 中的 View 从上向下布局,最底部的 View 的 MaxY 刚好是 Cell 所需高度即可】【不要设置底部约束限制,从上向下布局即可,内部会自动去获取最底部的 View 然后把它的 MaxY 做为 Cell 所需的高度 在 代码 144~167 行 可查看获取过程,然后做各种缓存操作 】

  • 在 UITableView 获取高度的代理方法里实现如下代码,Block 中的代码和 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 中的代码一致即可。

  • 现在你的 UITableView 已经自动算高自动缓存高度了,效果如下:

框架实现原理

高度计算原理

提前创建 Cell,然后填充内容,然后强制布局,然后获取 Cell 中 MaxY 最大的 View,然后取此 View 的 MaxY 为 Cell 所需高度【所以保证 Cell 中的 View 的 MaxY 最大的值即为 Cell 需要的高度至关重要】,内部会自动管理缓存的保存和清空操作。

问题

  • 系统自动算高的缺陷大家应该都比较清楚,如:没缓存,重复计算,界面跳动,由于是边滚边算在布局复杂的 Cell 有一些问题,只支持iOS8+,布局必须要填充整个 Cell,在布局的时候一些场景需要设置优先,不然会报约束冲突。

  • UITableView-FDTemplateLayoutCell 最开始我使用是此框架,同时 API 设计也参考自 FDTemplateLayoutCell,还用了几张素材,😁,在此感谢了 ,但后面有一些 Bug 一直没处理 😭,布局必须要填充整个 Cell,在布局的时候一些场景需要设置优先级,不然会报约束冲突,就迁移到了 UITableViewDynamicLayoutCacheHeight

  • UITableViewDynamicLayoutCacheHeight 的缺陷有,

    • ① 可能会多加一个 View【可以在计算的结果上加上底部距离,不建议这样处理】
  • 基于此框架实现了一个简陋的微信朋友圈功能 微信朋友圈 代码是几年前随便写的 😂,没准备调整了,感兴趣的可以瞧瞧。

常见问题处理

  • 如果使用 key 做缓存,表示高度只和 key 有关,只要使用相同的 key 就会得到相同的高度,内部永远不会刷新这个高度「 即使调用了 reloadData 」。

联系

  • 欢迎 issuesPR
  • 也可以添加微信 进微信交流群。

License

UITableViewDynamicLayoutCacheHeight is released under the MIT license. See LICENSE for details.

广告时间 😁,下面是我开发的几款小程序,感兴趣的可以看看,点点广告就更好了,哈哈哈~~~

  • 便捷的日历小程序,支持节假日,调休等
  • rl

  • 便捷的工资扣税计算器。
  • jsq

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].