首页 > 代码库 > UILabel调整字间距

UILabel调整字间距

1、引入

 技术分享

在文件导入

#import <CoreText/CoreText.h>


2、程序

   

NSMutableAttributedString *attributedString =[[NSMutableAttributedString alloc]initWithString:@"你的字符串"];
    long number = 5.0f;//间距
    CFNumberRef num = CFNumberCreate(kCFAllocatorDefault,kCFNumberSInt8Type,&number);
    [attributedString addAttribute:(id)kCTKernAttributeName value:(__bridge id)num range:NSMakeRange(0,[attributedString length])];
    CFRelease(num);
     [ColumnIntroduce setAttributedText:attributedString];

UILabel调整字间距