Latest 1.0.2
Homepage https://github.com/shunFSKi/FSAutoAdjust-cellHeightDemo
License MIT
Platforms ios 7.0
Authors

FSAutoAdjust-cellHeightDemo

cell行高自适应,一句代码搞定需求,丝滑般顺畅的滚动体验

API

支持两种缓存方式

/**
 cell自动计算行高

 @param tableView tableView
 @param indexPath indexPath
 @param contentViewWidth cell内容宽度,不确定可传0
 @return cell高度
 */
+ (CGFloat)FSCellHeightForTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath cellContentViewWidth:(CGFloat)contentViewWidth bottomOffset:(CGFloat)bottomOffset;
/**
 cell自动计算行高优化版

 @param tableView tableView
 @param indexPath indexPath
 @param cacheKey 当前cell唯一标识符
 @param contentViewWidth cell内容宽度,不确定可传0
 @return cell高度
 */
+ (CGFloat)FSCellHeightForTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath cacheKey:(NSString *)cacheKey cellContentViewWidth:(CGFloat)contentViewWidth bottomOffset:(CGFloat)bottomOffset;

How To Use

1、将demo中的FSAutoAdjust-cellHeightLib拖入项目中导入#import "UITableViewCell+FSAutoCountHeight.h"

2、cocoapods:pod search FSAutoAdjust-cellHeight 如果找不到执行pod setuppod 'FSAutoAdjust-cellHeight'

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    FSEntity *entity = _datas[indexPath.row];
    CGFloat height = [self.title isEqualToString:@"keyCache"]?[FSTestTableViewCell FSCellHeightForTableView:tableView indexPath:indexPath cacheKey:entity.identifier cellContentViewWidth:0 bottomOffset:0]:[FSTestTableViewCell FSCellHeightForTableView:tableView indexPath:indexPath cellContentViewWidth:0 bottomOffset:0];
    return height;
}

详细请下载demo查看

Document

文档正在努力编写中。。。

文章地址:http://www.jianshu.com/p/16a67c58c8c4

Version

1.0.2 ——>添加cocoapods支持 2017.8.7

Latest podspec

{
    "name": "FSAutoAdjust-cellHeight",
    "version": "1.0.2",
    "summary": "A FSAutoAdjust-cellHeight.",
    "description": "cellu884cu9ad8u81eau9002u5e94uff0cu4e00u53e5u4ee3u7801u641eu5b9au9700u6c42uff0cu4e1du6ed1u822cu987au7545u7684u6edau52a8u4f53u9a8cuff0cu539fu7406u7b80u5355uff0cu4f7fu7528u65b9u4fbf",
    "homepage": "https://github.com/shunFSKi/FSAutoAdjust-cellHeightDemo",
    "license": "MIT",
    "authors": {
        "u51afu987a": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/shunFSKi/FSAutoAdjust-cellHeightDemo.git",
        "tag": "1.0.2"
    },
    "source_files": [
        "FSAutoAdjust-cellHeightLib",
        "FSAutoAdjust-cellHeightLib/**/*.{h,m}"
    ]
}

Pin It on Pinterest

Share This