如何同时滑入/滑出状态栏和导航栏?

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.

这篇关于如何同时滑入/滑出状态栏和导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Get an event when UIBarButtonItem menu is displayed(显示UIBarButtonItem菜单时获取事件)