I want to create a custom navigation bar like that
Here is a default translucent navigation bar. I want to add a new view with the same background color as in the navigation bar below the navigation bar. But i don't know what is the actual colour of the navigation bar. Or maybe there is other way to create a custom navigation bar.
Update
I need different presentations of a navigation bar for different view controllers inside one navigation controller. Also a navigation bar should have different functionality for different controllers, that is why I don't think that subclassing a UINavigationBar is a good idea.
I found the answer in this answer. I removed a bottom border from a navigation bar, placed a blur view below the navigation bar and added a bottom border to it.
Related
When you use View that related to Navigation Controller, it will have Navigation Bar more high, but what to do if my view is based on Tab Bar Controller ? The Title Text possition is almost jam the timer on status bar. Is it possible to adjust margin or padding, or even adjust the Navigation Bar height ?
LINK TO IMAGAE
I set the Storyboard like this:
Tab Bar Controller--->Navigation Controller--->myView
Yezzz, it works. But I am not sure if this is the wrong way ? If not this is very good news for me.
I am developing a UINavigationController based app where one of the view i am presenting is modal where i need a navigation bar which i have manually added but problem is the statusbar and navigation bar colors are different and both are translucent though, is there a way to set both same the way they appear on UINavigationController?
OK finally I think this is what i had to do ,
on presenting the view modally I am loosing the transluscent status bar instead get a transparent status bar,and also required to add my own navigation bar,thats how ios7 handles the status bar now, what i did is I wrapped the modally presented view into a navigation controller and then presented it , no changes i was required to do in segues just embedded the modal view controller in a navigation controller.
To embed a view in navigation controller in storyboard , just select the view go to Editor menu and select embed in-> navigation controller option.
I'm updating an App to support iOS7. I have a Tab control with a number of tabs - several table views and one UI view. The strange thing is that IF the Navigation bar in the top is translucent, it has a different appearences depending on whether the tab control shows a table view or the UI view. The navigation bar seems to always be opaque when the UI view is selected.
Unchecking "Extend Edges - [ ] Under top bar" in the table views also make the navigation bar the same color for all views.
So the question boils down to that the navigation bar for the UI view doesn't seem to be translucent?
Set the navigationBar to be translucent in your viewDidLoad method:
self.navigationController.navigationBar.translucent = YES;
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.
I added a Navigation Bar to the .xib.
I did that because I want to customize a lot of things of it. I want my navigation controller to use that navigation bar in that screen.
I created the outlet named navBar and did:
[self.navigationController.navigationBar = navBar;
But it says that navigationBar is readonly. Is it possible to link my existing navigation controller with the navigation bar that I added to the screen?
It sounds to me that you may not actually want to use a UINavigationBar. As it states in the reference documentation:
The UINavigationBar class implements a control for navigating hierarchical content. It’s a bar, typically displayed at the top of the screen, containing buttons for navigating up and down a hierarchy. The primary properties are a left (back) button, a center title, and an optional right button. You can specify custom views for each of these.
So if you're planned customizations go beyond adding buttons, changing it's color / background, opacity, hiding etc.. you might be better off creating a UIView that mimics the look & feel of a navigation bar.
Here's an example of how to give your UIView that gradient look of a navigation bar.
It's far more flexible and actually quite easy to do BUT you've got alot of reading and testing ahead of you :).
Just in case if it's just buttons you're thinking of adding you might be better off using UIToolbar instead
You can't do that. Since the navigation controller's navigation bar has a lot of settings embedded, it's a readonly property and you shouldn't be able to change it.
What exactly are you trying to achieve that you need to do that via interface builder. I mean, with the newest APIs, it should be simple to do everything you want with a few lines of code, by customising the original navcontroller's navbar.
You would not manage a navigation bar in interface builder. Also, you would not try to set the navigationBar property of the navigation controller.
To make changes you would make changes to the navigationItem property of the navigationBar
[self.navigationController.navigationBar setItems:newNavItems];
You can also make other changes to the navigationBar such as setting a background image or making it translucent
self.navigationController.navigationBar.translucent = true;
[self.navigationController.navigationBar setBackgroundImage:img forBarMetrics:barMetrics];