zoukankan      html  css  js  c++  java
  • 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);
     }
  • 相关阅读:
    tp5中调用接口api中的数据
    TP5.0如何转换成SQL语句输出构造器里面的方法
    unlink() 函数删除文件。
    tp5 图片上传
    Java第十一章多线程
    Java Character类
    前端技术学习路线及技术汇总
    Web发展史
    HTML
    JavaNumber类&JavaMath类
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2663112.html
Copyright © 2011-2022 走看看