这是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];*/
.

只有当我更改背景颜色时才有效,但我如何用图像替换背景替换背景?


[S O L V E D]

现在它的作品!!

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

有帮助吗?

解决方案

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+

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top