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;
    }
  • 相关阅读:
    会议记录
    周总结
    团队博客
    周总结
    移动端疫情展示
    代码规范
    阅读笔记2
    解决 import numpy as np ModuleNotFoundError: No module named 'numpy'错误
    周总结
    爬取最新疫情数据
  • 原文地址:https://www.cnblogs.com/yuqingzhude/p/4844896.html
Copyright © 2011-2022 走看看