change image background in a moreNavigationController navigationBar ios 5
-
14-11-2019 - |
Question
this is the 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];*/
it works only if i change the background color, but how can I do to replace the background with an image?
[ S O L V E D ]
Now its works!!
[moreController.navigationBar setBackgroundImage:[UIImage imageNamed: @"navBar.png"] forBarMetrics:UIBarMetricsDefault];
Solution
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+
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow