问题
I am trying to change the default font of Back button in UINavigationController to a custom font
UIFont *myCustomFont = [UIFont fontWithName:@"MyCustomFont" size:18];
How can I set this custom font to the Back Button? I've browsed through other answers to similar questions in this site with no success.
回答1:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:
@{UITextAttributeTextColor:[UIColor blackColor],
UITextAttributeTextShadowOffset:[NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
UITextAttributeTextShadowColor:[UIColor whiteColor],
UITextAttributeFont: myCustomFont
}
forState:UIControlStateNormal];
来源:https://stackoverflow.com/questions/21084316/change-the-default-font-of-back-button-in-uinavigationcontroller