zoukankan      html  css  js  c++  java
  • iOS 改变同一个label中多行文字间的距离

        UILabel *titleLabel = [[UILabel alloc] init];

        titleLabel.text = @"很抱歉,没有找到相关文件 您可以申请添加";

        titleLabel.numberOfLines = 2;

        titleLabel.font = [UIFont systemFontOfSize:13.0];

        titleLabel.textColor = [UIColor colorWithHexString:@"#999999"];

     

      //上下间距

        NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:titleLabel.text];;

        NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];

        [paragraphStyle setLineSpacing:8];

        [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, titleLabel.text.length)];

        titleLabel.attributedText = attributedString;

        

        titleLabel.textAlignment = NSTextAlignmentCenter;

        [view addSubview:titleLabel];

        

        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {

            make.top.equalTo(imgV.mas_bottom).offset(12);

            make.left.equalTo(view.mas_left);

            make.right.equalTo(view.mas_right);

        }];

     

  • 相关阅读:
    24. Swap Nodes in Pairs
    23. Merge k Sorted Lists
    shell脚本报错:"[: =: unary operator expected"
    一种用 数组元素 指定 所调函数 的方法
    阻塞 非阻塞
    Linux open() 一个函数,两个函数原型
    QT 执行windows cmd 命令并读取结果
    Qt5 escape spaces in path
    获取磁盘的 总容量,空余容量,已用容量 【windows】
    通过进程名称,获取其路径
  • 原文地址:https://www.cnblogs.com/ios988/p/6519933.html
Copyright © 2011-2022 走看看