【问题标题】:change image background in a moreNavigationController navigationBar ios 5在moreNavigationController navigationBar ios 5中更改图像背景
【发布时间】:2012-02-29 18:02:25
【问题描述】:

这是应用代理:

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

【问题讨论】:

  • 非常感谢!现在可以了!!! [moreController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBar.png"] forBarMetrics:UIBarMetricsDefault];

标签: ios background customization navigationcontroller navigationbar


【解决方案1】:

我发现这确实有效并且已经实现[navBar setBackgroundImage:[UIImage imageNamed: @"image.png"] forBarMetrics:UIBarMetricsDefault];

还可以查看https://developer.apple.com/library/ios/#documentation/uikit/reference/UINavigationBar_Class/Reference/UINavigationBar.html 上的 Apple Docs,它进一步解释了自定义 UINavigationBar 的内容和方法。目标需要是iOS5+

【讨论】:

  • @Luca Zap。没问题,乐于助人!!
猜你喜欢
  • 1970-01-01
  • 2014-03-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-01-09
相关资源
最近更新 更多