I read several answers to this question but couldn't figure out how to do it. I'm using Xcode 4.2 with ARC and no storyboards.
I'm developing an app based on the TabBar application template and extended it to contain 4 UITabBars. I'm not using UINavigationController but instead using UINavigationBar next to the status bar. When the app is loaded with the first tab shown, I have a button on the UINavigationBar and when I press it, I want to hide the UITabBar and instead show the UIToolBar at the same location where the UITabBar was located.
I tried to hide and show using the hidden property (hiding the UITabBar and showing UIToolBar). What happens is the UITabBar is hidden but the UIToolBar is shown above the location where the UITabBar was shown before. This looks ugly and I want it to be shown at the very bottom of the screen.
I think I can't use hidesBottomBarWhenPushed as I don't use a UINavigationController but instead using Navigation bar directly.
Also, I want to revert back to showing the UITabBar and hide the UIToolBar when pressing the same button on the UINavigationBar.
I am not sure if my idea would work for your scenario. Here it is...
but before, just let me tell you that hiding UITabBar, unlike hiding UINavigationBar is not animated. So to me, hiding tabBar is not a user-friendly approach, unless you create your own subclass of UITabBarController that animates hiding the UITabBar.
You can use presentModalViewController:animated and dismissModalViewControllerAnimated: methods. The viewController that is being shown modally can have a UINavigationBar, it pops out from the bottom of the screen and covers the UITabBar with animation.
Hope that helps.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
Related
How can we attach a view to a UITabBar or UITabBarController and allow it to conform to things like "Hide bottom bar on push"? Any view that gets added to the UITabBarController will a part of the UINavigationController, meaning that the view will not take part in the tab bar animation, and will simply be left visible after a push.
Is it frowned upon to subclass UITabBar itself, and if not, how would we handle the subviews of it? My attachment is located behind the tab bar and becomes visible when needed (like Spotify's or Apple Music's player bar), which causes problems when iOS automatically moves the z-index of the tab bar during these situations.
I am trying to 3D peek and pop items in a UITableView. Everything works fine, except the target ViewController has a UINavigationBar which also shows.
I added my UINavigationBar to my ViewController code through Interface Builder and set self.navBar.isHidden to true which hides the UINavigationBar, but it leaves empty space equal to the size of the UINavigationBar.
Does anyone know how to hide the UINavigationBar properly?
Note: I am not using a UINavigationController, I simply added the UINavigationBar to my ViewController by drag/drop.
the target ViewController has a UINavigationBar which also shows
Use a real UINavigationController plus UITableViewController (as its root view controller). This is an excellent way to have a navigation bar even if you never intend doing any navigation.
Here's a big advantage of doing that: You don't even need to hide the navigation bar when you peek! Use the UITableViewController alone as the peek navigation controller, and the UINavigationController when you pop. Thus, the preview won't have any navigation bar but if the user presses all the way and you do the real transition, the new view controller will have the navigation bar. Remember, no law says that the peek view controller must be the same as the pop view controller!
How to implement such a navigation bar? I am aware of the title view but not aware of any subtitle view.
One way I can think of is setting UINavigationBar shadow image to nil and place collection view below the navigation bar. But that won't give me translucency of Navigation bar.
Is there a native way (which may have been introduced in iOS9) of doing so?
I think you'll have to make custom view and will have to use it as navigation bar. Hide the default navigation bar and use your custom view.
I wanted to make the nav.bar as shown in picture with the functionality like tab bar and i've made custom view for that purpose.
You can use a library like PageMenu or PagingMenuController to do this easily.
I am having some trouble hiding toolbar (Bottom bar) on one of the view controllers in my iOS app. So I have a home view controller which has a navigation bar and a toolbar. Then a UIPageViewController is pushed (a tutorial for the app). There should be no navigation or toolbar on this screen.
I used the standard code to hide the toolbar. Here it is:
self.navigationController.toolbarHidden = YES;
It works in iOS 8 but not in iOS 7. I tried many variations and tried putting it in viewDidLayoutSubviews, viewWillAppear, viewDidappear and also right before pushing the view controller. Nothing works. Hiding navigation bar worked without issues.
Any help is much appreciated.
A better property to use when you want the toolbar hidden when pushing is setting hidesBottomBarWhenPushed to YES on the UIViewController you are pushing.
I am not a huge fan of using Interface Builder and for that reason I am new to it.
I am trying to add a UIToolbar to a navigation controller but because Apple documentation is always very clear, I don't have a clue.
I am converting an old project to use Storyboards.
This is what I have done.
I have added a storyboard to the project
I have added a navigation controller to it
Because I want this navigation controller to show a toolbar at the bottom, I have clicked on the navigation controller and turned the toolbar on (see pic).
after that, a white rectangle appeared at the bottom of the navigation controller on interface builder. I think this is a the UIToolBar or a placeholder. I have tried to drag a BarButtonItem to this "space" and Xcode allowed, showing it like this:
When I run the app, the toolbar shows as a white rectangle at the bottom but not the button.
The button shows like this on the hierarchy:
I suppose the button should be inside the Toolbar item, but Xcode forbids dragging the item there.
How do I make the button show?
The problem here is that your are trying to add an UIToolBar in a UINavigationController ...
Try in an UIViewController and that will work !
Edit:
Try this :
You just drag and drop the UINavigationItem on UINavigation RootViewController instead of UIToolbar.
It will allow you to put UIBarButtonItem on that UINavigationItem and works same like UIToolbar Button.