2013-12-12 9 views
1

У меня есть UINavigationBar styling, установленный в AppDelegate, но он, похоже, не влияет на мое приложение. Я использую XCode 5, и мой код выглядит следующим образом:UINavigationBar должен быть прозрачным

- (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]]; 
} 

Я не уверен, что я делаю неправильно и почему его не работает. Это работает в XCode 4/iOS6

enter image description here

ответ

0

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

+0

Где я могу добавить этот код? – Omar

+0

Метод bettat добавляет этот метод, когда вы создаете UINavigationController, или добавляете его в приложение AppDelegate.m под - (BOOL): (UIApplication *) приложение didFinishLaunchingWithOptions: (NSDictionary *) метод launchOptions. –

+0

Также вы можете сослаться на эту ссылку: [Сделать UINavigationBar прозрачным] (http://stackoverflow.com/questions/2315862/make-uinavigationbar-transparent) –

Смежные вопросы