1

I have got UINavigationBar styling set in AppDelegate but it doesn't seem to be taking effect on my app. I am using XCode 5 and my code is as follows:

- (void) customizeApp

{
    UIImage* menuBackground = [UIImage imageNamed:@"menu-bar.png"];

    [[UINavigationBar appearance] setBackgroundImage:menuBackground forBarMetrics:UIBarMetricsDefault];

    // Customize the title text for *all* UINavigationBars
    [[UINavigationBar appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor colorWithRed:255.0/255.0 green:255.0/255.0 blue:255.0/255.0 alpha:1.0],
      UITextAttributeTextColor,
      [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8],
      UITextAttributeTextShadowColor,
      [NSValue valueWithUIOffset:UIOffsetMake(0, -1)],
      UITextAttributeTextShadowOffset,
      [UIFont fontWithName:@"HelveticaNeue-Light" size:0.0],
      UITextAttributeFont,
      nil]];
}

Im not sure what Im doing wrong and why its not working. This was working in XCode 4/iOS6

enter image description here

Sviatoslav Yakymiv
  • 7,887
  • 2
  • 23
  • 43
Omar
  • 979
  • 3
  • 16
  • 26

1 Answers1

0

[self.navigationController.navigationBar setBackgroundImage:menuBackground forBarMetrics: UIBarMetricsDefault];

Mehul Sojitra
  • 1,181
  • 9
  • 15
  • The bettat way is add this method where you create UINavigationController, Or add it in AppDelegate.m file under - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method. – Mehul Sojitra Sep 15 '15 at 16:42
  • Also you can refer this link : [Make UINavigationBar transparent](http://stackoverflow.com/questions/2315862/make-uinavigationbar-transparent) – Mehul Sojitra Sep 15 '15 at 16:50