1

これは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];*/

背景色を変更した場合にのみ機能しますが、背景を画像に置き換えるにはどうすればよいですか?


[解決済み]

今その作品!

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

4

1 に答える 1

2

これは機能し、実装されていることがわかりました[navBar setBackgroundImage:[UIImage imageNamed: @"image.png"] forBarMetrics:UIBarMetricsDefault];

また、このhttps://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html でAppleDocsを調べてください。UINavigationBarをカスタマイズする方法と方法についてさらに説明しています。ターゲットはiOS5以降である必要があります

于 2012-02-29T18:13:55.157 に答える