How to slide in/out statusBar and navigationBar simultaneously?(如何同时滑入/滑出状态栏和导航栏?)
问题描述
我想使用幻灯片效果同时显示和隐藏状态栏和导航栏.
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.
这篇关于如何同时滑入/滑出状态栏和导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何同时滑入/滑出状态栏和导航栏?


- UITextView 内容插图 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- URL编码Swift iOS 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01