UITableView使用autolayout如何自适应高度
2014-04-16 11:11
477 查看
- (CGFloat) tableView: (UITableView *) tableView heightForRowAtIndexPath: (NSIndexPath *) indexPath { static TSTableViewCell *sizingCell; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sizingCell = (TSTableViewCell*)[tableView dequeueReusableCellWithIdentifier: @"TSTableViewCell"]; }); // configure the cell sizingCell.text = self.cellText; // force layout [sizingCell setNeedsLayout]; [sizingCell layoutIfNeeded]; // get the fitting size CGSize s = [sizingCell.contentView systemLayoutSizeFittingSize: UILayoutFittingCompressedSize]; NSLog( @"fittingSize: %@", NSStringFromCGSize( s )); return s.height; }
相关文章推荐
- Masonry和FDTemplateLayoutCell搭配使用「UITableview自适应内容高度」
- 【iOS】Masonry和FDTemplateLayoutCell搭配使用「UITableview自适应内容高度」
- UITableView tableFooterView autolayout自动计算高度
- 如何在 AutoLayout 中使用 UIScrollView (多个ContentView)
- UITableView介绍 之 AutoLayout下复杂cell的高度计算
- 如何在 AutoLayout 中使用 UIScrollView (多个ContentView)
- iOS UITableView+FDTemplateLayoutCell 配合AutoLayout分分钟教你实现动态高度自适应
- UITableView tableHeaderView autolayout自动计算高度
- 使用autolayout设置UITableView的tableHeaderView
- 如何使用AutoLayout对两个以及两个以上的平行或者相互依赖的view进行布局
- AutoLayout深入浅出五[UITableView动态高度]
- 使用UITableView+FDTemplateLayoutCell计算cell的高度
- Android中RecycleView使用GridLayoutManager时自适应高度
- UIday1101:UITableView 3 自定义cell 多种cell混合使用 cell自适应高度
- 如何在 AutoLayout 中使用 UIScrollView (多个ContentView)
- UITableViewCell高度自适应探索--UITableView+FDTemplateLayoutCell(转载)
- iOS autolayout自适应cell高度时使用estimatedRowHeight的一些问题
- UITableViewCell使用AutoLayout自适应高度
- tableviewcell 中使用autolayout自适应高度
- swift学习 - tableView自适应高度1(xib autoLayout)