Hide Tab Bar in Navigation Interface
As a fresh start of the series, we’ll show you how to hide the tab bar in a navigation-based app. Several weeks ago, we developed the tab bar app. In that tutorial, we embed the navigation controller inside the tab bar controller. So when user taps on any of the recipes, the navigation controller pushes to the detail view.

Tab Bar App with Tab Bar in Detail View
Some said the tab bar takes up considerable screen estate when displaying the detail view. How can we hide it to free up more space for better reading?
If you’ve read the official API reference of UIViewController, you know the tab bar can be hidden using a line of code. There is a property named “hidesBottomBarWhenPushed” in UIViewController. It’s a Boolean value indicating whether the toolbar at the bottom of the screen is hidden. When it’s set to YES, the tab bar will be hidden when the view controller is pushed on to a navigation controller.
In our code of the Tab Bar app, we can simply add a line of code in “prepareForSegue:” method and set the “hidesBottomBarWhenPushed” properties of the RecipeDetailViewController to “YES”.
Save the change and run the app. The tab bar should be hidden when the detail view is displayed.

Tab Bar App with Hidden Tab Bar in Detail View
What Do You Think?
What do you think about this mini tutorial? Does it help to solve the common iOS programming issue you encounter? Leave us comment to share your thought and let us know what else you’d like to see in the next mini tutorial.
Comments
Post a Comment
Thank You.