以流畅的动画显示/隐藏导航栏 [英] Showing/hiding navigation bar with smooth animation

查看:21
本文介绍了以流畅的动画显示/隐藏导航栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于导航的应用程序.第一个视图(rootcontroller)仅以三个大按钮开始.没有导航栏.从那里开始,其他一切都是表格视图并具有导航栏.我这样做是为了显示/隐藏导航栏:

I have a navigation based app. The first view (rootcontroller) starts with three large buttons only. No navigationbar. From there, everything else is tableviews and have navigation bars. I'm doing this to show/hide the navigation bar:

MyAppAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
appDelegate.navigationController.navigationBar.hidden = NO;

一旦我离开了根控制器,导航栏会突然就位并位于 tableview 的顶部,而不是向下推.它剪辑了 tableview 的顶部.导航栏消失的方式返回到根控制器并不顺利.是否有更流畅/更好的方法来完成仅隐藏根控制器的导航栏?

Once I leave the root controller, the navigation bar will jerk into place and lay on top of the tableview, rather than pushing it down. It clips the top part of the tableview. Going back to the root controller isn't smooth in how the navigation bar disappears. Is there a smoother/better way to do accomplish hiding the navigation bar for the root controller only?

推荐答案

可以使用[navigationController setNavigationBarHidden:YES animated:YES]来平滑隐藏bar.

You can use [navigationController setNavigationBarHidden:YES animated:YES] to hide the bar smoothly.

参考

这篇关于以流畅的动画显示/隐藏导航栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆