How to make the navigationBar float on top of current view? [duplicate] - iphone

I have multiple UIViewControllers in a UINavigationController. Sometimes I show the bar, sometimes I don't. How do I make the navigation bar show without pushing down the view?

The navigation bar will always push down the view unless it's set to be translucent.

You can override pushViewController: method

Related

Animate NavigationController transition without animating navigation bar

I have a typical ios app with a navigationcontroller. The navigation bar on the top has left and right buttons that stay the same through different views, so I would like to animate just the current view and not the top bar.
I'm not sure how to get started with this.
I've got an idea.
First, add your custom navigation bar on the top of the main view.
Second, add a navigationController as a subview under your navigation bar.
Now if the navigationController do the pushing or popping, your navigation bar will not change at all.

iPhone Dev - Is it possible to remove a button from a UINavigationController's navigationBar?

When I push a view via my app's navigationController, it automatically puts a back button on the left side of the navigationBar. Is there any way I can just remove this? (I want to put my own buttons on the screen that will allow the view to be popped).
From the comments, you can hide the back button for a viewController by using its navigationItem property. (which is the UINavigationItem corresponding to that viewController in the stack of the navigationController. its how you control what shows up on the bar for specific view controllers (see Apple Doc here)).
To answer your question, set the navigationItem's hidesBackButton property to YES. Something like this probably called in your viewControllers viewDidLoad: or similar method.
myViewController.navigationItem.hidesBackButton = YES;
have you try with self.navigationItem.hidesBackButton=YES;?
If I wanted to do it, I'd hide the Navigation bar on push (non animated hide), add a toolbar, and add any custom stuff I want to the toolbar.
on popping the view controller, make sure to unhide the navigation bar. It'll work

Switching Views within UITabBar View

I have created an UITabView application. Each view selected from the bar is a seperate controller with own nib file. I switch between them succesfully.
In the first view I have two buttons (check out the screenshot). When clicking them I want to switch to another views which are the parts of the current view controller. I use:
[self presentModalViewController:anotherViewController animated:NO];
That switches the view, but hides the UITabBar. How to keep the bar on the screen after the switch?
P.S. Sorry for the blurred image. I am not allowed to share to much info.
Well I think you are misusing the modal view controller. For a problem like this I'll say you should put them in a view controller stack using UINavigationController. Instead of making each tab a UIViewController make it a UINavigationController, then you can push and pop view controllers on it, which still show the tab bar.
See http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UINavigationController_Class/Reference/Reference.html
use: tabBarController.selectedViewController = newViewController
edit: UINavigationController is not needed here.

How to hide an iPhone Tab Bar?

I have a small multiview app. It consists of a UITabBarController with a nav controller in each tab. What I want is to show a UIImageView when a user shakes the device. After I've implemented the loading of the UIImageView, I faced a problem-the image was only 2/3 of the screen because of the tab and nav bars. I managed to hide the nav bar but I'm still stuck with the tab bar. I tried many solutions such as [tabBar setHidden: YES]; but I get errors "tabBar undeclared", although I've imported the AppDelegate, where the tabBar was defined.
Thanks in advance!
Try setting
myViewController.hidesBottomBarWhenPushed = YES;
when you create your UIImageView. When you push it on to the view stack the UITabBar will hide automatically, and it will be restored automatically when you pop or dismiss the controller. No need for the application delegate.
If you want to show a full screen view, it is best to use a modal view controller. This way you do have to worry about hiding/showing navigation items. Take a look at:
http://developer.apple.com/iphone/library/featuredarticles/ViewControllerPGforiPhoneOS/ModalViewControllers/ModalViewControllers.html
to get started.

UINavigationController inside a UITabBarController inside a UINavigationController

My problem is that I want to have a tab bar view with its children view controllers shown first. In the children view controllers, depending on what controls are clicked, I either want to A) drill down within the tab bar view (swiping away the child view controller) or B) drill down over the tab bar view (swiping away the tab bar view controller).
I've tried solving this problem by wrapping a navigation controller within the children view controllers (so I can drill down using method A) of the tab bar controller and then wrapping another navigation controller around the tab bar controller itself (so I can drill down using method B), hence the title. So it goes:
Window -> UINavigationController -> UITabBarController -> UINavigationController -> child view controller
The problem is that I end up with two navigation bars:
two navigation bars!! http://img527.imageshack.us/img527/240/problemc.png
Has anyone else had this problem, and if so, how did you get around it?
Thanks!
In this case, perhaps you can simply use a UITabBar and programmatically manage its state, without nesting a tab bar controller inside another controller.
If you're using two nested UINavigationControllers I don't think you can work around having two nav bars. You may be able to subclass or method swizzle UINavigationController for the controller whose bar you don't want to show, and somehow prevent it from appearing or being created. You can probably also set the navigation bar's opaque property or hidden property accordingly which may also work, but you would probably need to do some fancy UIView rearranging to prevent empty gaps.
This is purely speculation; i don't know if either approach would work or how they would, but those ideas are what i would get started with were i trying to do this.
Just hide the bar you don't want, easy as this:
[navigationController setNavigationBarHidden:YES animated:NO];