行间距
- (NSMutableAttributedString *)lineSpace:(int)height WithString:(NSString *)string{
NSMutableAttributedString *attributedString1=[[NSMutableAttributedString alloc]initWithString:string];
NSMutableParagraphStyle *paragraphStyle1=[[NSMutableParagraphStyle alloc]init];
[paragraphStyle1 setLineSpacing:70];
[attributedString1 addAttribute:NSParagraphStyleAttributeName value:paragraphStyle1 range:NSMakeRange(0, [string length])];
return attributedString1;
}
字间距
#import CoreText/CoreText.h
- (NSMutableAttributedString *)charSpace:(int)width WithString:(NSString *)string {
NSMutableAttributedString *attributedString =[[NSMutableAttributedString alloc]initWithString:string];
CFNumberRef num = CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&width);
[attributedString addAttribute:(id)kCTKernAttributeName value:(__bridge id)num range:NSMakeRange(0,[attributedString length])];
CFRelease(num);
return attributedString;
}