【发布时间】:2014-10-21 12:12:34
【问题描述】:
我正在尝试从一个 VC 推送到另一个 - 这是 0 问题,但是 VC1 有一个橙色的 NavigationBar,而 VC2 有一个完全透明的 NavigationBar。我想在 push segue 期间在 2 个不同的 NavigationBars 之间平滑过渡。然而,目前 - 它出现了这个黑色的滑动条,颜色并没有很好地过渡。这是我的代码:
VC1 viewWillAppear:
// Set the BarTintColor to translucent and text colors to white
[UIView animateWithDuration:0.5 animations:^{
self.navigationController.navigationBar.barTintColor = [UIColor orangeColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
}];
VC 2 viewWillAppear:
// Make the NavigationBar transparent
[UIView animateWithDuration:0.5 animations:^{
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor];
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage = [UIImage new];
self.navigationController.navigationBar.translucent = YES;
}];
我怎样才能以更有效和更好的方式解决这个问题?
谢谢! 埃里克
【问题讨论】:
-
这个问题让人头疼。真的,我认为最好的解决方案就是滑入新的(“超过”旧的)
-
@JoeBlow 一个解决方案是切换到模态呈现它而不是推送它。您认为最好的解决方案是什么?
-
FTR 你试过这个吗? . stackoverflow.com/a/1618557/294884
-
@JoeBlow 试过了,但你只是没有得到那种解决方案的“高级感觉”:/
-
@JoeBlow 我修好了:):) 看看我的回答
标签: ios objective-c uiview uinavigationcontroller uinavigationbar