2015-01-20 131 views
-1

下面的代码是我一直在设置导航栏外观tintcolor的地方。我将如何添加背景图片?导航栏外观和背景图片

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{ 
    [[UINavigationBar appearance] setBarTintColor: 
          [UIColor colorWithRed:0.158 green:0.457 blue:0.405 alpha:1]]; 

回答

0

您可以使用-setBackgroundImage:forBarMetrics:方法。这是最简单的方法。 例如:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navBarBackground"] forBarMetrics:UIBarMetricsDefault]