zoukankan      html  css  js  c++  java
  • iOS7中Cell高度 Label高度自适应

    
- (float)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
        NSString *str = [_dataArray objectAtIndex:indexPath.row];
        UIFont *tfont = [UIFont systemFontOfSize:14.0];
        NSDictionary * dic = [NSDictionary dictionaryWithObjectsAndKeys:tfont,NSFontAttributeName,nil];
        //   ios 7
        CGSize sizeText = [str boundingRectWithSize:CGSizeMake(320, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil].size;
        //   ios 6
        CGSize sizeText1 = [str sizeWithFont:[UIFont systemFontOfSize:16.0f] constrainedToSize:CGSizeMake(320, 1000) lineBreakMode:NSLineBreakByCharWrapping];
        return sizeText1.height+50; 	
    
    }

  • 相关阅读:
    java爬取Excel表格
    drf-view
    django--View
    tornado的Application的一些事儿
    tornado的路由分发
    线程和asyncio的比较
    GIL
    else的使用
    协程
    生成器代替迭代器
  • 原文地址:https://www.cnblogs.com/jz319/p/3781325.html
Copyright © 2011-2022 走看看