How to put a view on the back button of navigation bar? - objective-c

How to put a view on the back button of navigation bar?
Not on title view, but on the back button. It seems like to me that the back button is a UIBarButtonItem, which doesn't inherite UIView.

You can do it programmatically using initWithCustomView.
AtomicElementViewController.m has a good example of this.

Related

UIBarButtonItem on UINavigationBar in UITabBarController

I'm new here. Sorry for may English.
I work on an iPhone application, which has an Tab Bar Controller (within an Navigation Controller). The Tab Bar Controller has four tabs and an Navigation Bar with default Back Button. I will set an other Bar Button Item on this Navigation Bar (on Tab Bar Controller). That is easy with drag and drop on storyboard, but I can't set an action for this new bar button item.
I know that I should set up a delegate for my UITabBarController, but I don't know how.
Can anyone help?
Thanks!
You usually create IBOutlets/IBActions by cntrl+dragging outlet from the story board to your code.Try to do the following:
Don't forget to switch to assistant editor to split your screen
Click on this button to switch to assistant editor

Putting a toolbar directly under a navigation controller without hiding the content underneath the toolbar

I am trying to put a toolbar directly beneath a navigation bar but I need the toolbar to not hide the content from the view directly beneath it. My quick solution was to set the navigation controller's native toolbar to visible, which works and properly resizes the view beneath it so that it doesn't let anything hide behind it, BUT the default toolbar shows at the bottom of the screen.
I need it to be at the top, just under the nav bar. I figure the easy solution would be to change the frame of the default toolbar (which I don't know how to do) OR to position a new instance of the toolbar onto the view (which works but it hides the content beneath it) but have it resize the views below.
Please see the following image that I found to see what I'm trying to do. (note how the tableview's first row starts UNDER the tab bar)
Thanks!!!
You are confusing two things. The NavigationController toolbar property IS the bottom bar, any toolbar that you add to a view has nothing to do with the nav controller but is a property of that view.
If you have your own toolbar at the top of a view you need to move the rest of the view content down or set that toolbar to translucent if thats what your looking for.
Again the nav controller toolbar is always the bottom bar, the toolbar you drop in IB is just a toolbar for that view that you can put anywhere.
I don't believe you can change the frame of the default toolbar. You will need to create your own instance of a toolbar, position it at the bottom of the navigation bar and resize your tableView to fit below.
We can't see how you have your views set up but if you are starting with a view that is subclassed as UITableViewController you will have trouble doing that. What you want is to start with a UIViewController as your master controller, add a tableview and toolbar as subviews. Then position and size them as appropriate.
If you are hiding and showing the toolbar you will create a method to move it up under the navigation controller and again resize the tableview.

custom navigation bar?

I have a custom navigation bar that looks like this:
I set it as the background image of the navigation bar. But how do I implement the buttons? I want to be able to click on the individual text and have an action happen
Could I possibly add a gesture recognizer over each word on the image?
Put an invisible button on the toolbar for each place you want to have a button. If you want this to look and behave exactly like a normal toolbar, however, you can't have the buttons be part of the background image. It's very easy to make a toolbar that looks like what you have in IB.
It took longer to upload this to imgur than it did to make it!

Edit Button on Navigation Controller

I have a navigation controller in my app and on its root view controller i have an Edit button as the rightBarButtonItem.
I have a second table view which is pushed when a cell is tapped on the root view controller.
The leftBarButtonItem becomes the Back button.
I would like an Edit button as well, where can i put it that would make the most sense? My rightBarButtonItem is a + button, so that rules that out.
I would like to be able to tap a cell and change the cells text.
Thanks
The easiest thing to do is add a toolbar at the bottom that contains an edit button.
You could also try adding a bar button item with a custom view that contains two UIButtons and set it as the right bar button item of your view controller's navigation item. I haven't actually tried this, so I don't really know if or how well it would work.

iphone app navigation bar multiple items

how can I have a back button and another button both on the left side of the nav bar?
Do you also need the title? If not, you can simply place the button in the center area. Otherwise, if you also need the title, you will need to create a UIView with a label and a button in it and set that as the center view. You will have to set the label's text manually if the title of the view ever changes.
Or, if you don't care too much about the back button, you can create a button that looks like the back button and put your other button next to it in a parent view that you use as the left view. You would have to manually handle going back when pressing the back button, and unless you got an image that looks like the back button, your button would not have the arrow shape.