UITabBarController 像照片应用程序一样用动画隐藏显示栏
我在使用 UITabBarController 时遇到了真正的麻烦。我有一个简单的照片应用程序,我正在尝试模拟与 Iphone 中的 PhotoApp 几乎相同的行为 主视图控制器是选项卡栏本身,我还有一个导航栏和顶部的状态栏。
我想要的是点击隐藏栏(不是使用计时器,只是点击)。 照片实际上是一个 UIScroll 视图,可以缩放照片或使其再次变为 1:1。这部分已经可以工作了,
在将视图推送到导航栏之前我已经尝试过设置 hidesBottomBarWhenPushed 并且它可以工作,但是我无法设置自定义动画,这不是真正的问题,我无法再次显示栏,它们消失了,我不知道如何重新显示它们,我确信我可能错过了一些非常明显的东西,但由于我在 obj C 方面的经验几乎没有半年的兼职时间,我想我在这里问的是 stackoverflow似乎得到了答案:)
i'm having a real trouble with UITabBarController. I have a simple foto app, and I'm trying to simulate almost the same behaviour as the PhotoApp from the Iphone
the main view controler is the tabbar itself, i also have a NavBar and a status bar on top.
What i want is on tap to hide the bars (not with timer, just on tap).
The photo is actually an UIScroll view that zooms the photo or makes it again 1:1. that part already works,
I've tried before pushing the view to the navbar to set the hidesBottomBarWhenPushed and well it works, but i can't set a custom animation, and that's not the real problem , I can't show again the bars, they dissapear and i don't know how to reshow them, i'm sure i'm probably missing someting very obvious, but as my experience in obj C is little like half a year part time, i thought i asked here as stackoverflow seems to get the answers :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
需要调查的内容:Three20 项目:http://github.com/facebook/ Three20 - 它包括组件形式的照片浏览应用程序的完全克隆。
但如果没有 Three20,您就无法使用普通的
UINavigationController
来执行此操作,因为您使用的UIViewController
是UINavigationController
的子视图。您需要在另一层上创建同级视图。为此,请创建一个父UIViewController
,它有两个子视图:您的照片和 UIToolbar。您可以通过设置 UIToolbar 的hidden
属性来隐藏和显示 UIToolbar,并使用[parent.view BringSubviewToFront:toolbarController]
确保它位于照片视图上方(其中parent
是包含照片视图和UIToolbar
的主 UIViewController)Something to investigate: the Three20 project: http://github.com/facebook/three20 - it includes a completely clone of the photo-browsing app in component form.
But without Three20, you can't do this with a stock
UINavigationController
, because theUIViewController
that you're using is a subview of theUINavigationController
. You need to make a sibling view on another layer. To do this, make a parentUIViewController
which has two subviews: your photo, and a UIToolbar. You can hide and display the UIToolbar by setting it'shidden
property, and make sure it's above the photo view with[parent.view bringSubviewToFront:toolbarController]
(whereparent
is the main UIViewController that contains both the photo view and theUIToolbar
)