iOS Left "More" UIBarButtonItem (in navigation controller) if UITabBar is hidden - objective-c

In my ios5 application I have a TabBar, and for each tab I have a navigation Controller.
I have more than 5 tabs, but if I set HIDDEN to YES to my tab bar a UIBarButtonItem with text "More" will appear in my navigation bar (leftItemsSupplementBackButton is set to YES) to the left - only in rootViewControllers, and there's no way to get reference to this button.
Pressing this button it will go to moreNavigationController.
Any ideas how to hide this button?

The More Button is the back button standard will appear automatically if one of the > 4 tab bar item is selected, even if tab bar is hidden. The workaround to get hidden this button is to hide, only if view controller is rootviewcontroller, the back button:
self.navigationItem.hidesBackButton = YES;

Related

Hiding (not removing) A UITabBarController UITabBarItem

I need to hide a button on the tab bar, but still have it accessible by code as needed. I know I can completely remove the button, but then I cannot access that view anymore.
So in my case, I want my home screen to be visible when the app first loads, but do not want the tab to show up for it. If they navigate away from that screen, I will add a custom "home" button in the navigation bar at the top.
However, if I remove the tab bar item, I no longer go to the home screen anymore but to what was originally the 2nd tab. Is there a way to only hide the tab bar item and still access it in code?
So you can see how I'm accessing the tab bar to begin with, here is how I can remove the tab bar item.
UITabBarController *tabVC = (UITabBarController *)self.window.rootViewController;
NSMutableArray *tabBarViewControllers = [NSMutableArray arrayWithArray:[tabVC viewControllers]];
[tabBarViewControllers removeObjectAtIndex:0];
[tabVC setViewControllers:tabBarViewControllers];
//or to just disable it
NSArray *tbItems = tabVC.tabBar.items;
UITabBarItem *item_0 = [tbItems objectAtIndex:0];
[item_0 setEnabled:NO];
There is an option of hiding the bottom TabBar in the attributes inspector
"Hide bottom bar on push"
You might find this link useful
How to hide/show tab bar of a view with a navigation bar in iOS?

How to add extra tab bar button in tab bar controller without adding view controller on that button in iOS

How to add tab bar item in tab bar view controller without adding a view controller with that and tap on that button no view controller are open. Tap on that tap bar button a alert will show.
On view did load create a UITabBarItem programmatically with a special tag. In your tab controller set the delegate to your view controller. On the method
- (void)tabBar:(UITabBar *)tabBar
didSelectItem:(UITabBarItem *)item
Check to see if the item has your custom tag and if so present an alert. If it requires a view to be linked with the UITabBarItem simply just set a view of another UITabBarItem for your alert view bar item.

navigation toolbar with items app wide

is it possible to make the navigation controller's toolbar show the same button items in all of my viewcontrollers using the storyboard?
So far, I have enabled the "Show Toolbar" checkbox in the navigation controller. I have also added one Bar Button Item (item1) to the first view controller. But this bar button disappears when I go to the next view controller. I want that button item to stay there in the toolbar regardless of what view controller is being shown.

UISearchBar in navigation bar from UIBarButton in iOS7

I would like to have my search bar launched from a UIBarButton that I have added to my navigation bar from the storyboard. I have also added the Search Bar and Search Display Controller to the document outline in my view controller from the storyboard.
If I implement the code below in my viewDidLoad method the search bar will automatically appear in my navigation bar self.searchDisplayController.displaysSearchBarInNavigationBar = YES;
However, when I try and implement this in from a button click from my navigation bar nothing happens.
(IBAction)serachBarButton:(id)sender
{
self.searchDisplayController.displaysSearchBarInNavigationBar = YES;
}
The IBAction is properly hooked up to the view controller in the storyboard. Any code examples of how to launch the search bar from my navigation button click would be greatly appreciated.

iOS - Set UIToolBarItem on UINavigationController

I drag out a toolbaritem in storyboard and set it on my nav controller, but when I run my code it's not there, is there something I'm missing?
EDIT:
Tried setting it in code as well in my viewDidLoad method:
UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithTitle:#"Map" style:UIBarButtonItemStyleBordered target:self action:#selector(viewMap)];
self.navigationItem.rightBarButtonItem = rightBarButton;
Won't work either.
Here's how it's set up in my storyboard:
UPDATE:
Just found my problem. In my controller code when I update it's contents I change the right bar button item for a spinner and never set it back to what it had before.
UINavigationController already has a toolbar built in. It has a property toolBarHidden which is set to YES by default, which is why it is not normally seen. If you are using storyboard you can easily make the built-in bottom toolbar visible by checking the checkbox "Shows Toolbar" in the inspector when the Navigation Controller is selected.
See the UINavigationController documentation here for more details.
EDIT:
Ok, it sounds like what you are trying to do is add a right button to your view controller's UINavigationItem. To do this in storyboard, drag a "Bar Button Item" from the Objects Library onto the Navigation Item in your ViewController. You can then set the title/style/etc of the bar button item. If nothing still shows up when you run your app, make sure that your ViewController is connected properly with a segue to the navigation controller.
Also make sure you are adding the Bar Button Item to your view controller's Navigation Item, NOT to the View Controller itself. Here is how the setup should look in your storyboard:
To add an item to a navigation bar, you need to add a Bar Button Item to the Navigation Item contained in the view controller. Go to your storyboard, find the right VC, and find the navigation item (it's in the hierarchy shown in the navigation controller 'scene'). Just drag a Bar Button Item into that hierarchy underneath the nav item, or directly onto the navbar in the visual builder display.
The navigation controller only looks at your VC's nav item when that VC is pushed onto the stack; hence modifying the VC's nav item in viewDidLoad has no effect.
(I've done this programmatically before but I don't have the code with me, so maybe I'll add that later...)