首页 > 技术文章 > iOS textfield设置字符间距

guchunli 2017-03-20 18:36 原文

添加富文本属性:

NSDictionary *attrsDictionary =@{
                    NSFontAttributeName: self.textField.font,
                    NSKernAttributeName:[NSNumber numberWithFloat:10.0f]//这里修改字符间距
                    };
self.textField.attributedText=[[NSAttributedString alloc]initWithString:text attributes:attrsDictionary];

 

推荐阅读