I have four tabBarItem
s. 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.
精彩评论