您的位置:首页 > 产品设计 > UI/UE

UILabel 行间距

2015-06-02 18:31 465 查看
UILabel * headLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, 15, ZRFullScreenWidth - 30, 40)];
headLabel.backgroundColor = [UIColor clearColor];
headLabel.textColor = HEXRGBCOLOR(0xB7B7B7);
headLabel.text = @"为了更好地为您提供挂号服务,请填写真实的就诊人信息,以及手机号用于发送预约码";
[headLabel setNumberOfLines:0];

NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.lineSpacing = 10;// 字体的行间距

NSDictionary *newAttribute = @{
NSFontAttributeName:[UIFont fontWithName:@"Helvetica" size:14.0f],
NSParagraphStyleAttributeName:paragraphStyle
};
NSAttributedString *newAttributeStr = [[NSAttributedString alloc]initWithString:headLabel.text attributes:newAttribute];

[headLabel setAttributedText:newAttributeStr];
[headLabel sizeToFit];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: