我尝试更改为导航栏的背景。如何更改导航栏背景
Search.h:
#import <UIKit/UIKit.h>
@interface Search : UIViewController
@end
Search.m:
#import "Search.h"
@implementation Search
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UIImage *image = [UIImage imageNamed:@"navigation_header.png"];
[self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
}
我不能改变导航的背景。
谢谢。
在'UINavigationController *'类型的对象上找不到属性'navBar' –
使用此self.navigationController.navigationBar –
现在没有错误,但背景不变。 –