I am using AMSlideMenu. Here is my requirement. How should I add the custom button?
You can make a custom UINavigationBar and add your UIBarButtonItem there, or just add on each view controller's navigationItem
Related
Prior to iOS 8 I could simply drag the UIBarButtonItem from the object library to a navigation bar. But now I simply can't if it is not the first view controller on the navigation stack.
I know I can do it in code but is there any way I can make it happen in Storyboard?
Yes you can. First drag-drop a UINavigationItem to your ViewController. This will add a title bar. Then drag a UIBarButtonItem and drop in the nav bar. This works.
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.
I am in the designing of ios view. I would like to add a top bar.
I know I can use navigation bar, but I am not sure if this is the prefered way. I think I don't need home button.
Just using the navigationItem in the xib file,and setting its property,but not using NavigationController.
It seems like it's pushing to a new view controller, but that segmented control doesn't move. I don't think it's a table header or a custom UIBarButtonItem in the nav bar. How do they do it?
You can subclass your navigation controller and add custom subview.
I'm developer in
objective c and I need help with with set
custom navigation bar on navigation controller
programmatically I don't use story board or xib.
you can use this, if your targeting iOS 5 and above
[MyNavigationController.navigationBar setBackgroundImage:[UIImage imageNamed:#"customNavBar.png"] forBarMetrics:UIBarMetricsDefault];
or
[[MyNavigationController.navigationBar appearance] setBackgroundImage:navBackground forBarMetrics:UIBarMetricsDefault];
you may need to add custom NavBar Buttons.
also have a look at the Answers here.
If you want more than just customizing appearance, then you can:
Create a subclass of UIView (this will be your custom navigation bar)
Create a custom view controller container that will contain an instance of UINavigationController
Make the instance of UINavigationController not display its navigation bar
Add your custom navigation bar and navigation controller's view as subviews of your custom view controller container (also add your instance of UINavigationController as a child controller of your custom view controller container)
Add methods for popping and pushing view controllers to your custom view controller container
This way you have full control over your custom navigation bar. You can read about view controller containment in the documentation for UIViewController.