Tag: 字距

如何在UINavigationBar标题上设置字距(字符间距) – Swift或Objective-C

我有我的导航栏主要定制为我喜欢,但我想增加使用NSKernAttributeName字距。 我使用外观代理将导航​​栏设置为白色文本和自定义字体,但是当我尝试添加字距时,它不起作用。 [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont fontWithName:@"HelveticaNeue-Light" size:20.0], NSFontAttributeName, [NSNumber numberWithFloat:2.0], NSKernAttributeName, nil]]; 我是否需要做一些其他的事情来添加一些不太常见的属性,如标题标签中的字距?