Hide TabBar when clicked on one tab Item - iphone

I have four tabBarItems. When a user clicks on 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.

Related

Navigation bar is missing in Tabbar based application sometimes when application entered in to background

I have the tab bar based application and each tab is a navigation based viewcontroller sometimes when my application entered in to background, and it comes back to foreground i am missing the navigation bar in the viewcontroller.
Why it happening like this?
Check that the UINavigationController's navigationBarHidden property is set to NO. If it is check the frame of the UINavigationBar (and all other relevant UIView properties like hidden, alpha etc).

Invisible back button when view controller pushed onto navigation controller

I'm using a navigation controller to drill into a detail view when a cell is tapped. When I push my view controller onto the navigation controllers stack, I expect to see a back button that I can tap to pop the previous view off the stack.
The issue is that the back button isn't visible, but when tapping where it should be returns me to the previous view. What's the problem?
Ensure you have set a title for the master view - for example in viewDidLoad add this -
self.title = #"The Title";
Weirdly, if there is no title for the parent view controller on the stack, rather than show an empty back button, the iPhone will not display a button but will allow taps on the area where it should be.
This bugged me for a long time!
At least as of iPhone 3.0, you can also avoid the dreaded invisible back button by setting a title on the root controller's navigation item in your main window's nib (MainWindow.xib in wizard-generated projects).
Lets see if this helps you.
I had the same issue where I used a navigation based application and set up my search, rotation etc..
BUT, when I clicked on the table cell I was directed to the next view but that view did not have a back button present.
I tried to add a title to the back button but that did not work so this is what I did.
I opened the mainWindow.xib file and added a Bar Button Item to the group of other items inisde the window (where the file's owner is located). I then assigned an image to the button (you can add text here if you want).
Then I clicked on the Navigation Item and hit command 2 to open up the Navigation item connections
and chose the back bar button item and dragged it to the bar button item I wanted to use for my back button. And there you have it.

How do I support the touch of the navigation bar label?

I have an editor that I am making, and I need a way of editing the document's title. I was considering touching the title of the navigation item and have a custom view appear.
I did this in an initial version of the application with a button bar item (and target/action), but I cannot seem to find a way to do it with the managed navigation bar.
The alternative I was considering was putting another bar at the bottom with an item to do just that, but it doesn't seem like the best design if I don't need to do it, as it takes away from viewing space.
You can set the titleView property of the view controller's navigationItem to a UIButton of type Custom. Then wire the button up to a method on the view controller. Now when the user taps the title, it'll fire the method on your controller.

Is there any way to display the arrow button on UINavigationbar without actually pushing a controller?

As titled. I need a way to display the arrow buttom on UINavigationbar without actually pushing a controller. The reason why I can't push a controller is because I need to keep the keyboard displayed while transitioning.
So to clarify: I start with a modal view controller (where there's nothing on the top left bar) like this -
(source: iphonefaq.org)
Then transition the top bar to one that looks like this -
(source: gizmodo.com)
Sure, you can do this pretty easily. Just set the leftBarButtonItem of your self.navigationItem to be a back button.
It looks like you can do this by getting the UINavigationItem for the current screen. You can get it from the topItem property of the UINavigationBar.
Once you have the UINavigationItem that represents your current title are you should be able to experiment with the backBarButtonItem property, then call setHidesBackButton:animated: to show the back button.
You can*not* dynamically change the backbutton on the UINavigationItem instance that belongs to the UIViewController instance that is currently being displayed. The backbutton that you will see displayed is the last one that was set before the UIViewController instance (and its UINAvigationItem) was pushed.
BUT, you can show/hide the backbutton. So how about setting the correct backbutton before the UIViewController instance is pushed and hiding it (viewControllerInstance.navigationItem.hidesBackButton = YES;"). And then setting "viewControllerInstance.navigationItem.hidesBackButton = NO;" when you want to display the back button.
You can obviously dynamically change the UINavigationItems and their backbuttons on a UINavigationBar that you create yourself (i.e. one that does not belong to a UINavigationController).

Overlaying views & positioning

I have a tab bar view, and another UIView which contains a button, which needs to be visible just above the tab bar.
I have added another view which always sits above the current select tab's view, but can't figure out how to make it sit just above the tab bar Screenshot http://img.skitch.com/20090524-jq6ufyiwp6c2uu1x5tkrrsd97m.jpg
I would suggest sub-classing the tabbar to include the new view. That way you do not have to worry about a tab overlaying the view. All your resizing should be done automatically and you will never accidentally hide a component.
You can also have the controller also look after the button and view that you add. you would just need to replace the tabbar in the tabbarviewcontroller to be your one.
Add your view with button in the tab bar view and use either one of these
– bringSubviewToFront:
– insertSubview:aboveSubview:
to put it above all and check how many pixels you need to position your button so that it does not get above the tabs.
You could also add it at the window level.