سؤال

Just as described above, I wonder if there is some way to set custom letter spacing for UINavigationBar's title.

I know there is a way to set letter spacing to for ex. label by using NSMutableAttributedString, but unfortunately UINavigation bar does not work that way.

Is there any workaround for setting that?

هل كانت مفيدة؟

المحلول

You can use NSAttributrString for UINavigationBar title:

NSDictionary *attributrs = @{ UITextAttributeTextColor : [UIColor redColor], UITextAttributeFont : [UIFont fontWithName:@"ArialMT" size:14.0]};
[[UINavigationBar appearance] setTitleTextAttributes: attributrs];

You can add it to AppDelegate didFinishLaunchingWithOptions: methods and all of your NSNavBar will apply this.

نصائح أخرى

is possible, set self.navigationItem.titleView with any view you need, possible UILlabel

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top