开发者

Hide TabBar when clicked on one tab Item

开发者 https://www.devze.com 2023-03-07 12:46 出处:网络
I have four tabBarItems.When a user clicks o开发者_运维技巧n the first tab item the tab bar should be hidden.The other three tab bars should appear.Is this possible?Warning up front: this is an unusua

I have four tabBarItems. When a user clicks o开发者_运维技巧n the first tab item the tab bar should be hidden. The other three tab bars should appear. Is this possible?


Warning up front: this is an unusual handling of tab bars.

If you hook up the UITabBarItem as an IBOutlet, and also hook up the UITabBarController's delegate, then in the method tabBarController:didSelectViewController: you can test to see if the user has tapped the tab bar you're interested in. If so, you can set it's title property to @"" and if it has an image you can set it's image property to nil.

This will look sort of strange though - it will give you a fully functioning tabBarItem, that is basically transparent.

If you really want the tabBarItem to disappear, remove it from the tabBarController, by resetting the tabBarControllers.viewControllers property to an array that does NOT contain the viewController you want to hide.

0

精彩评论

暂无评论...
验证码 换一张
取 消