I'm doing the following in my code to change the font of the back button:
[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,[UIFont fontWithName:@"Freshman" size:13.0f],UITextAttributeFont, nil] forState:UIControlStateNormal];
But the word "Back" is awkwardly towards the top of the back button, not centered to fit it like it normally does. I'm talking about it being centered in regards to the top and bottom, not from right to left. How can I fix this? It seems like I can only change the Shadow and ShadowOffset using the UITextAttributeShadow, so I don't know how to make it look centered.
Any help is appreciated!
Try something like this:
[[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, 10) forBarMetrics:UIBarMetricsDefault];
Please Check Reference Docs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.