Domanda

Questo è l'AppDelegate:

  UINavigationController *moreController = _tbc.moreNavigationController;
    moreController.navigationBar.tintColor = [UIColor blackColor];


    UIImage *image = [UIImage imageNamed:@"navBar.png"]; 
    [image drawInRect:rect];



    /*    UITableView *moreTableView = (UITableView *)moreController.topViewController.view;
     //   [moreTableView initWithFrame:CGRectZero style:UITableViewStyleGrouped];
     [moreTableView setBackgroundColor:BACKGROUNDCOLOUR];*/
.

funziona solo se cambio il colore di sfondo, ma come posso fare per sostituire lo sfondo con un'immagine?


.

[s o l v e d]

Ora i suoi lavori !!

[moreController.navigationBar setBackgroundImage:[UIImage imageNamed: @"navBar.png"] forBarMetrics:UIBarMetricsDefault];

È stato utile?

Soluzione

I found that this does work and has been implemented [navBar setBackgroundImage:[UIImage imageNamed: @"image.png"] forBarMetrics:UIBarMetricsDefault];

Also take a look into the Apple Docs on this https://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html It gives further explanation on what and how to customise UINavigationBar. Target needs to be iOS5+

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top