我想使用幻灯片效果同时显示和隐藏状态栏和导航栏.
I'd like to show and hide the statusBar and the navigationBar simultaneously using a slide effect.
我就是这样尝试的:
[[UIApplication sharedApplication] setStatusBarHidden:hide withAnimation:UIStatusBarAnimationSlide];
[self.navigationController setNavigationBarHidden:hide animated:animated];
但是,两个动画的持续时间是不一样的.状态栏动画需要更长的时间.我发现无法指定任一动画的持续时间.我错过了什么明显的东西吗?
However, the duration of both animation is not the same. The status bar animation takes longer. I found no way how to specify the duration of either animation. Did I miss something obvious?
显然,没有简单的解决方案可以做到这一点.苹果必须修复它.
Clearly, there's no easy solution to do this right. Apple has to fix it.
当然,一种解决方法是按照 Ephraim 的建议使用 alpha 衰减.如果您坚持滑动行为,我发现最好只为导航栏设置动画并隐藏/显示状态栏而不使用任何动画.这看起来比滑动状态栏要好得多,因为动画期间状态栏之间的间隙非常明显.
Of course, one work-around is to use alpha fading as Ephraim suggests. If you're insisting on the sliding behavior, I found it best to just animate the navigation bar and hide/show the statusBar without any animation. This looks much better than sliding the status bar because the gap between the bars during the animation is quite noticeable.
这篇关于如何同时滑入/滑出状态栏和导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!