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.
这篇关于如何同时滑入/滑出状态栏和导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何同时滑入/滑出状态栏和导航栏?


基础教程推荐
- Android - 如何在runOnUiThread 中将数据传递给Runnable? 2022-01-01
- 在视图控制器的宽度上水平均匀分布 UIButton 的最简单方法? 2022-01-01
- UINavigationBar 隐藏按钮文本 2022-01-01
- 在 iOS 7 下 CCMenu 错位 2022-01-01
- 从 UIWebView 访问元数据 2022-01-01
- UINavigationItem 的持久 rightBarButtonItem 属性 2022-01-01
- Firebase 云消息传递令牌未生成 2022-01-01
- EditText 中的 setHintTextColor() 2022-01-01
- 更改 UITableView 部分标题的颜色 2022-01-01
- iOS4 创建后台定时器 2022-01-01