cell单元格高度自适应
2015-07-19 13:50
288 查看
//接收字符串并计算出高度
+ (CGFloat)cellForHeight:(NSString *)content {
CGSize size = [content sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:CGSizeMake(KScreenWidth-92-14, 1000)];
return size.height + 60;
}
/**计算单元格行高*/
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_indexPathIndex == indexPath) {
commDataModel *model = self.data[indexPath.row];
CGFloat Hight = [CommTableViewCell cellWithHight:model.content];
if (Hight < 90) {
return 90;
}
return Hight;
}
return 80;
}
#pragma mark - 单元格点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
/**记录点击的单元格*/
_indexPathIndex = indexPath;
//[tableView reloadData];
[tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
相关文章推荐
- eclipse中创建tomcat服务器问题总结
- python的split用法
- CURD操作详解
- 用java 判断mysql中某个表是否存在
- 计算文字尺寸
- itoa()进制转换函数
- Java中static关键字总结
- binbinyang---百度地图androidAPI Android SDK v3.5.0-------------1.Hello BaiduMap
- 陈力:传智播客古代 珍宝币 泡泡龙游戏开发第二讲html运行原理及结构
- perror和strerror的问题
- 游戏程序员养成计划
- 随机森林分类(Random Forest Classification)
- CentOS 7.0 VMware虚拟机 查找不到网卡 查找不到eth0
- 【猫猫的Unity Shader之旅】之纹理映射
- 拓撲排序學習
- RequireJS实例分析
- 认识一下身边的互联网---经典互联网书籍阅读总结
- 视图翻转
- 康托尔连续统假设正确吗?
- 字母重排