3

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.

enter image description here

Bijoy Thangaraj
  • 5,434
  • 4
  • 43
  • 70

1 Answers1

3
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:
        @{UITextAttributeTextColor:[UIColor blackColor],
         UITextAttributeTextShadowOffset:[NSValue valueWithUIOffset:UIOffsetMake(0, 1)],
         UITextAttributeTextShadowColor:[UIColor whiteColor],
         UITextAttributeFont: myCustomFont
        }
         forState:UIControlStateNormal];
nitin kachhadiya
  • 959
  • 2
  • 9
  • 21