// 调整行间距 NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:textStr]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; [paragraphStyle setLineSpacing:3]; [attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [textStr length])];
// 调整字间距 long number = 1.5; CFNumberRef num = CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&number); [attributedString addAttribute:(id)kCTKernAttributeName value:(__bridge id)num range:NSMakeRange(0,[attributedString length])];
sizeToFit后控件的高度是sizeWithFont:constrainedToSize:算出的1~N倍,醉了~