zoukankan      html  css  js  c++  java
  • iOS自定义文字高度添加行间距

    在创建cell时- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath





    NSString * sttr = [NSString stringWithFormat:@"%@%@",arrayload[indexPath.row],arraymodeltext[indexPath.row]]; NSMutableAttributedString * strAttebute = [[NSMutableAttributedString alloc] initWithString:sttr ]; //设置行间距 NSMutableParagraphStyle * paragraphStlyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStlyle setLineSpacing:IPHONEHIGHT(10)]; [strAttebute addAttribute:NSParagraphStyleAttributeName value:paragraphStlyle range:NSMakeRange(0, sttr.length)]; [strAttebute addAttribute:NSForegroundColorAttributeName value:qianse range:NSMakeRange(0, [arrayload[indexPath.row] length])]; full.labelText.attributedText = strAttebute; CGSize contentSize = [sttr boundingRectWithSize:CGSizeMake(ScreenWidth-IPHONEHIGHT(56),MAXFLOAT ) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:IPHONEWIDTH(30)]} context:NULL].size; full.labelText.size =CGSizeMake(contentSize.width, contentSize.height); height0 = contentSize.height; return full;
  • 相关阅读:
    编译安装redis-3.2.9(latest stable version)
    MySQL之从忘记密码到重置密码
    Linux时间和时区设定
    java.net.UnknownHostException 异常处理(转)
    制作FastDFS的RPM包
    RPM包安装MySQL 5.7.18
    白鹭http请求post
    iframe嵌套页面 跨域
    git 配置 https和ssh 免密码登录 常用操作命令
    php 错误提示开启
  • 原文地址:https://www.cnblogs.com/xujiahui/p/6689347.html
Copyright © 2011-2022 走看看