我有一个带有 UINavigationBar
和 UITabBar
的 UIViewController
。我想隐藏它们动画:UINavigationBar
向上翻转和 UITabBar
向下翻转。在动画期间,我需要 UIViewController
的 View 自动调整大小以满足新框架。
怎么做?
我的结构是: UIViewController
作为rootViewController
放在UINavigationController
中,UINavigationControlle
r 作为 childViewController
放置在 UITabBarController
中。
我试过直接调整 AppDelegate.window.frame
的大小,但这会使其他 views.frame 不正确。
最佳答案
从 iOS8 开始,您可以使用:
self.navigationController.hidesBarsOnSwipe = YES;
信息
自 iOS8 以来有很多不错的新方法:
UINavigationController
hidesBarsOnTap
:一个 bool 值,指示导航 Controller 是否允许使用点击手势隐藏其栏。
hidesBarsOnSwipe
:一个 bool 值,指示导航栏是否隐藏其栏以响应滑动手势。
hidesBarsWhenVerticallyCompact
:一个 bool 值,指示导航 Controller 是否在垂直紧凑环境中隐藏其栏。
hidesBarsWhenKeyboardAppears
:一个 bool 值,指示导航 Controller 是否在键盘出现时隐藏其栏。
关于ios - 如何隐藏 UINavigationBar 和 UITabBar 动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27521250/