Change the default font of Back button in UINavigationController

给你一囗甜甜゛ 提交于 2019-12-07 16:47:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!