【问题标题】:NavigationBar Button is not displaying导航栏按钮未显示
【发布时间】:2014-01-18 23:13:57
【问题描述】:

我有一个视图控制器,其中有导航栏。
我已将其色调设置为白色。现在我从该视图控制器展示图像选择器视图和贝宝页面。
当图像选择器视图或贝宝视图出现时,其导航栏不显示按钮(默认为取消按钮)。 按钮在那里,但它的颜色设置为白色。如何解决这个问题?我可以更改图像选择器视图的颜色吗? 我正在显示这样的导航栏:

 PaymentViewController *paymentVC=[[PaymentViewController alloc]initWithNibName:@"PaymentViewController" bundle:nil];
 UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:paymentVC];
 if ([navController.navigationBar respondsToSelector:@selector( setBackgroundImage:forBarMetrics:)])
 {
       UIImage *navBarImg = [UIImage imageNamed:@"top_bar"];
       [navController.navigationBar setBackgroundImage:navBarImg forBarMetrics:UIBarMetricsDefault];
 }
 [self.tabBar presentViewController:navController animated:NO completion:nil];

【问题讨论】:

  • 你能告诉我添加导航栏按钮的代码吗?

标签: ios iphone uinavigationcontroller


【解决方案1】:

改写下面的代码:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed: @"top_bar"] forBarMetrics:UIBarMetricsDefault];
PaymentViewController *paymentVC=[[PaymentViewController alloc]initWithNibName:@"PaymentViewController" bundle:nil];
UINavigationController *navController=[[UINavigationController alloc]initWithRootViewController:paymentVC];
[self.tabBar presentViewController:navController animated:NO completion:nil];

【讨论】:

  • 好的....这个 chagnged 的​​ paypal 和 imagepickerview 的导航栏图像...但是如果我不想更改它们的显示方式... ...
  • 只继承这两个类。在 viewWillAppear 中移除外观,在 viewDidDisappear 中再次应用。
猜你喜欢
  • 2019-01-11
  • 1970-01-01
  • 1970-01-01
  • 2017-01-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2013-01-20
相关资源
最近更新 更多