zoukankan      html  css  js  c++  java
  • tableViewcell高度自适应

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
           static NSString *identifier = @"Cell";
           CustomCell *cell = (CustomCell *)[tableView dequeueReusableCellWithIdentifier:identifier];
           if (!cell) {
               cell = [[[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil] lastObject];
           }
           CGSize boundSize = CGSizeMake(216, CGFLOAT_MAX);
           cell.workSituation.text = @"string......";
           cell.workSituation.numberOfLines = 0;
           CGSize requiredSize = [cell.workSituation.text sizeWithFont:[UIFont systemFontOfSize:13] constrainedToSize:boundSize lineBreakMode:UILineBreakModeWordWrap];
           CGRect rect = cell.frame;
            rect.size.height = requiredSize.height;
            cell.frame = rect;
           return cell;
    }


    - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
            UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
            return cell.frame.size.height;
    }
  • 相关阅读:
    spring in action小结4.1
    spring in action小结3 运行时值注入
    python-__init__.py 与模块对象的关系
    Python-常用库扩展
    Qt-优化布局结构
    Python-文件修改器
    C语言-数据结构(一)
    Python-PyQt4学习笔记
    Python-PyQt4学习资料汇总
    Linux-查看C语言手册及man的特殊用法
  • 原文地址:https://www.cnblogs.com/yuqingzhude/p/4844896.html
Copyright © 2011-2022 走看看