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;
    }
  • 相关阅读:
    MYSQL数据库导入SQL文件出现乱码解决方法
    Mysql设置允许用户可以连接
    MongoDB 设置权限认证
    NodeJs 服务端调试
    Hudson 定时编译
    Ubuntu上NodeJs环境安装
    新开通博客
    war类型项目创建
    Maven项目创建
    Maven简介与配置
  • 原文地址:https://www.cnblogs.com/yuqingzhude/p/4844896.html
Copyright © 2011-2022 走看看