Giter Site home page Giter Site logo

ixialuo / fsautoadjust-cellheightdemo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shunfski/fsautoadjust-cellheightdemo

0.0 2.0 0.0 1.96 MB

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

License: MIT License

Ruby 10.88% Objective-C 89.12%

fsautoadjust-cellheightdemo's Introduction

FSAutoAdjust-cellHeightDemo

badge-languages CocoaPods CocoaPods CocoaPods CocoaPods

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

fsautoadjust-cellheightdemo's People

Contributors

shunfski avatar

Watchers

James Cloos avatar Xia Luo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.