2

正如您在第四个 ViewController 中看到的那样,我有一个“ BackUIBarButtonItem

Back按钮连接到 IBAction :

- (IBAction)backClicked:(UIBarButtonItem *)sender
{
    [self.navigationController popViewControllerAnimated:YES];
}

但是当我popViewControllerAnimated:从第四个 ViewController 调用返回到第三个 ViewController 时,它会更改 Tab Bar Tab 的UINavigationBartintColor 的原始颜色。UITabBarController 的原始导航栏 tintColor 被AppDelegate设置为绿色,并且弹出将其更改为深灰色(第 4 个 VC 导航栏的颜色)

打电话时如何不丢失导航栏色调popViewControllerAnimated:?请帮忙,我这几天一直在努力解决这个问题。

4

2 回答 2

2

检查您没有在前一个视图的 viewWillAppear 中设置它。

于 2014-06-10T13:41:08.720 回答
0

代替

[self.navigationController popViewControllerAnimated:YES];

使用以下内容(这是快速代码)

self.dismissViewControllerAnimated(true, completion: nil)

添加第四个视图控制器时,您没有使用导航控制器。这就是为什么简单地调用dismissViewControllerAnimated 方法。

只有当您通过 pushViewController 方法添加视图控制器时,您才必须使用 UINavigationController 及其弹出方法。

我通过 - Go back to previous view controller doesn't work了解到这一点

于 2016-05-11T10:33:52.280 回答