How to add subview to UIViewController pushing UINavigationBar behind - iphone

What I want is as follows:
Basically I have a view controller with navigation bar. There is a menu button as left UINavigationBarItem. On click of menu button list of menu items will animate from top. This is achieved using 'addSubview' method. But menu list is added as subview below navigation bar. I want to add menu list view pushing navigation bar behind menu list view. I dont want to hide navigation bar.
Thanks

try:**[self.navigationController.view** addSubview:xxxView],this work to my app. Don't use [self.view addSubview:xxxView], that can't put the navigation bar behind.

Have you tried..? bringing your subview to front after adding the subview
//after adding your menu view
[self.view bringSubViewToFront:menuItemsView];
[self.view sendSubviewToBack:self.navigationController.navigationBar ];

I am not Sure but........ It may be not possible, because if You want to display your menu list behind your UINavigationBar then you need to hide your UINavigationBar without hidden UINavigationBar menu list will always display below the UINavigationBar.

Related

How to set the position of a Navigation Bar programmatically

How to set the position of a Navigation Bar programmatically? Autolay have been turned off as its causing issues in other IOS. Cheers guys.
[my layout]
View Controller
View
Toolbar
WebView
Navigation Bar
Nav Item
First Responder
Exit
Navigation bar is currently appearing at the bottom of the screen not the top where I want it.
Try this
[self.navigationController.navigationBar setFrame:CGRectMake(x,y,width,height)];
If you are using Interface Builder you can simply drag the navigation bar to where you want it

Unhide UINavigationBar LIKE in the Email App

I have a View Controller where I perform a "search as you type". When I press on the SearchBar, hide the Navigation Bar, animated and I also show the scope buttons for my SearchBar. The problem is that when I press on a cell to push a new View Controller the Navigation Bar stays hidden. I KNOW I can set it unhidden, but it will animate from the top. I want to do something similar like in the Email app, when I press on a new cell, a new View Controller is pushed, and the Navigation Bar is animated from the right, like it belongs with the pushed View Controller. How can I make this happen?
Thank you.
Cosmin
Use the UISearchDisplayController to handle the search bar. The behavior you describe is the default behavior.

UiNanigation Bar With background image and rightbarbutton item

i have added back ground image to UINavigationBar in drawrect method,image added properly.and also i added right bar button item to Navigation bar in View did load method.
my problem is i navigate to detail view and when i am coming back to rootview controller, right bar button item is not visible but button action working on navigation bar right side
Can Any one help to solve this
I would remove the background image. Apple engineers told me not to do this very thing. I would use the customise options in ios5 instead.

Why I can't add left bar button item to Navigation Item through Interface Builder?

It only allows me to add the right barbutton, but when I drag another barbuttonitem, it's simply denied.
I looked at the properties of NavigationItem, and I saw that there are outlets for right barbutton and even for the back barbutton.
So: why can't I add a left barbutton item to the Navigation Item (through Interface Builder)?
Yeah, using it programatically is probably (way) better.
Use [self.navigationController pushViewController:<otherviewname> animated:YES];
This way, in the next view, there is a backbutton to this screen added automatically (unless you decide to hide the backbutton programatically in that next view, but that's a whole different story).
The advantage of pushViewController instead of modalTransitionView is that navigation-options are so easily added!
It seems that you cannot add a button to a Navigation Bar if it is defined in the View properties, however if you add a Navigation Bar from the Object Library you can add buttons (left and right).

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.