你的位置:首页 > 操作系统

[操作系统]lable计算行高


 _introduce.text=status.introduce;    //设置行间距  NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc]initWithString:_introduce.text];;  NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc]init];  [paragraphStyle setLineSpacing:7];  [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, _introduce.text.length)];    _introduce.attributedText = attributedString;      NSString *introduce=status.introduce;    CGSize titleSize = [introduce boundingRectWithSize:CGSizeMake(KScreenWidth-80, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSParagraphStyleAttributeName:paragraphStyle} context:nil].size;    CGFloat height=titleSize.height;  

View Code