• Uilabel自动换行 UItableView适应高度


     //设置tableViewcell里uilabel、图片高度
        CGSize tbvContentSizeForheight = [cell.resultNoticeTableContent.text sizeWithFont:cell.resultNoticeTableContent.font];
        CGSize tbvContentSizeForLines = [cell.resultNoticeTableContent.text sizeWithFont:cell.resultNoticeTableContent.font constrainedToSize:CGSizeMake(280, MAXFLOAT) lineBreakMode:UILineBreakModeWordWrap];
    //最大行数
        cell.resultNoticeTableContent.numberOfLines =ceil(tbvContentSizeForLines.height/tbvContentSizeForheight.height);
    
    //自动换行
     if(cell.resultNoticeTableContent.numberOfLines<=1)
     {
     cell.resultNoticeTableContent.frame = CGRectMake(20, 80, 290,30);
     }
     else 
     {
       int tbvHight = cell.resultNoticeTableContent.frame.size.height*cell.resultNoticeTableContent.numberOfLines;
       cell.resultNoticeTableContent.frame = CGRectMake(20, cell.resultNoticeTableContent.frame.origin.y, 290,tbvHight    );
       //cell.resultNoticeImageView.image = [UIImage imageNamed:@"BG.png"];
       cell.resultNoticeImageView.frame = CGRectMake(10, 50, 300, cell.resultNoticeImageView.bounds.size.height+tbvHig    ht-30);
     }
  • 相关阅读:
    CodeForces
    POJ
    POJ 2260 Error Correction 模拟 贪心 简单题
    POJ
    HDU
    UVA
    CodeForces
    CodeForces
    常见的医学图像成像(总)
    ADNI数据集相关概念整理
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2663112.html
Copyright © 2020-2023  润新知