[英]Showing a overlaying menu when tab bar item is clicked - IOS
Thanks for reading my question! 感谢您阅读我的问题!
I have a 5-part tabbar which I use for app navigation, the center tab is covered by a UIButton
and is slightly larger (much like the instagram app). 我有一个5部分的标签栏,可用于应用程序导航,中间的标签页由UIButton
覆盖,并且稍大一些(非常类似于instagram应用程序)。 This works fine. 这很好。
But what I want is the far right tab bar item to show a overlaying menu when clicked. 但是我想要的是最右边的选项卡栏项目,当单击该选项卡时显示一个覆盖菜单。 I don't want it to switch to a viewcontroller
with a menu. 我不希望它切换到带有菜单的viewcontroller
。 I want the menu to be displayed no matter which of the other views you're in at the moment. 无论您当前处于哪个其他视图中,我都希望显示菜单。 So I want it to act much like a button which is in the tabbar. 因此,我希望它的行为就像标签栏中的按钮一样。 But I have no idea how to go about doing this. 但是我不知道该怎么做。
Should I use a overlaying button over the tabbaritem
or should I catch the tabbarclick, but how can I prevent the view from changing in that case? 我应该在tabbaritem
使用覆盖按钮还是应该捕获tabbarclick,但是在这种情况下如何防止视图更改?
Thanks you for any help! 感谢您的帮助!
You need to implement UITabBarDelegate
. 您需要实现UITabBarDelegate
。 Then override tabBar:didSelectItem:
and implement your custom displaying here. 然后覆盖tabBar:didSelectItem:
并在此处实现您的自定义显示。 See below for reference 请参阅下面的参考
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITabBarDelegate_Protocol/Reference/Reference.html http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITabBarDelegate_Protocol/Reference/Reference.html
Then i would just make a custom UIView
and fade it in when that specific tagged UITabBarItem
is pressed. 然后,我只想制作一个自定义UIView
并在按下该特定标记的UITabBarItem
时使其淡入。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.