淡出UINavigationBarController.navigationBar?

时间:2009-09-28 20:20:43

标签: iphone uinavigationcontroller uinavigationbar

我想让navigationBar淡出我的状态栏并将animated:设置为YES不起作用,因为它只是动画navigationBar 。我尝试过以下方法:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
self.navigationController.navigationBar.alpha = 0.0;
[UIView commitAnimations];
[[UIApplication sharedApplication] setStatusBarHidden:YES animated:YES];

但它不起作用。

1 个答案:

答案 0 :(得分:0)

这对你有用吗?

CATransition *_navigationAnimation = nil;
[CATransaction begin];
_navigationAnimation = [CATransition animation];
_navigationAnimation.type = kCATransitionFade;
_navigationAnimation.duration = 0.5;
[[self.navigationController.navigationBar layer] addAnimation:_navigationAnimation forKey:@"kNavigationBarAnimationKey"];
[CATransaction commit];