一行搞定cell自适应高度 -- ZXPAutoLayout框架的使用
来源:互联网 发布:淘宝密码怎么找回来 编辑:程序博客网 时间:2024/04/29 19:32
什么是ZXPAutoLayout ?
本篇只讲解如何使用ZXPAutoLayout
进行cell的自适应. ZXPAutoLayout
的简单介绍和入门请看这篇文章,请点我. github地址: 请点我
1.注册cell
cell 自适应高度之前请确保调用了tableview
的registerClass: forCellReuseIdentifier:
或者registerNib: forCellReuseIdentifier:
方法来注册cell
2. 在tableview的返回高度的方法调用zxp_cellHeightWithIdentifier: config:
方法即可
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { //cell 自适应的高度 + 10的距离, 调用此方法之前,请确保调用了 registerClass: forCellReuseIdentifier: 或者 registerNib: forCellReuseIdentifier: 方法来注册cell return [tableView zxp_cellHeightWithIdentifier:kTestCellID config:^(__kindof UITableViewCell *cell) { [self configTestCell:cell indexPath:indexPath]; } space:10];}
3.返回cell里指定view的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { //cell 自适应到textLabel的高度 + 10的距离, 调用此方法之前,请确保调用了 registerClass: forCellReuseIdentifier: 或者 registerNib: forCellReuseIdentifier: 方法来注册cell [tableView zxp_cellHeightWithIdentifier:kTestCellID configAndReturnView:^UIView *(__kindof UITableViewCell *cell) { return cell.textLabel; } space:10];}
0 0
- 一行搞定cell自适应高度 -- ZXPAutoLayout框架的使用
- 一行代码搞定UIlabel的高度自适应和行距
- 自动布局神器 -- ZXPAutoLayout框架的使用
- 使用storyboard tableView的cell自适应高度
- cell的自适应高度
- tableView 的cell自适应高度
- UITableView的cell自适应高度
- UITableView的cell自适应高度
- Swift cell的自适应高度
- Cell 的简单自适应高度
- 13 自定义cell、cell自适应高度、 多种类型的cell混合使用、 UITableViewController、model类
- cell的高度自适应cell里lable的高度
- iOS 8cell的高度的自适应
- 表的cell的高度自适应
- Cell自适应高度及自定义cell混合使用
- Tableview中cell的自适应高度
- tableView自适应cell的高度,提高性能
- iOS8 tableView的Cell高度自适应开发
- Develop--Training(五)Getting Started--Saving Data
- CSS3之变形处理
- Servlet之ServletContext读取web应用中的资源文件
- JAVA并发编程笔记二
- 1222 浙江中医药
- 一行搞定cell自适应高度 -- ZXPAutoLayout框架的使用
- Java基础之运算符和控制流程语句
- Android中的进程与线程
- 蓝懿iOS 技术内容和心得 12.13
- mongodb的主从复制和副本集
- 老实者,对别人说的话过于认可
- Navicat for MySQL工具中大小写敏感的情况下表名称会出现变小写
- WebDriver多浏览器测试
- handler动态更新UI