Objective c 清除导航栏中的背景图像
我的视图中有以下代码将出现在我的视图控制器中Objective c 清除导航栏中的背景图像,objective-c,ios,cocoa-touch,ios5,ios4,Objective C,Ios,Cocoa Touch,Ios5,Ios4,我的视图中有以下代码将出现在我的视图控制器中 - (void) viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; UIImage *image = [UIImage imageNamed:@"navbar.png"]; UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; [self.navigatio
- (void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIImage *image = [UIImage imageNamed:@"navbar.png"];
UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
[self.navigationController.navigationBar addSubview:imageView];
}
在添加新导航栏图像之前,如何清除已存在的导航栏背景图像,如上述代码所示
另外,如何以最有效的方式为每个不同的控制器设置不同的导航栏背景图像?谢谢 在VIEWWILLEXPENCE方法中,使用以下调用设置导航栏的背景图像
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar.png"] forBarMetrics:UIBarMetricsDefault];
如果您的应用程序也支持横向,您还需要为横向导航栏设置不同高度的背景图像:
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navbar_landscape.png"] forBarMetrics:UIBarMetricsLandscapePhone];
使用UIAppearance设置不同的导航栏样式。看,我有一个问题-当人们单击后退时,如何防止后退按钮被设置为动画?现在,单击“后退”按钮时,后退按钮会滑到中间。我们怎样才能停止呢?在ViewWillEnglish方法中,将back按钮设置为nil:self.navigationItem.LeftBarButtonim=nil