關於UINavigation bar的客製化設定

設定 navigation bar title:
[self.navigationController.navigationBar setTitleTextAttributes:
 [NSDictionary dictionaryWithObjectsAndKeys:
  [UIFont fontWithName:@"mplus-1c-regular" size:21],
  NSFontAttributeName, nil]];
設定 navigation bar back button的文字
必須要在上一層view controller設定:
self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"BACK" style:UIBarButtonItemStylePlain target:nil action:nil];

設定navigationbar item字型:
   //set backbutton font
NSDictionary *normalAttributes = [NSDictionary dictionaryWithObjectsAndKeys:
                                  [UIFont fontWithName:_dataManager.optionsSettings.fontString size:15], NSFontAttributeName,
                                  nil];
[[UIBarButtonItem appearance] setTitleTextAttributes:normalAttributes
                                            forState:UIControlStateNormal];

留言