I have a question: When I am trying to change the default height of navigation bar it is not possible for me to change it. How to change that height?
You can not change the height of navigation bar but you can make custom navigation bar with View and Images for look same as Navigation bar.
Related
The reason I want this second bar is because I want it to stay in the totality of my project. I want to have this bar under my navigationbar and stay constant throughout the run of my project.
The top red bar is the nav bar, and the top green bar is my bar. They will have different background colors. The orange/gray box represent the screens that will appear under these bars.
What is the best way to do this?
If it were me, I'd create a view controller called something like MyToolbarViewController and add its view as a child of your navigation controller. Use Auto Layout to give it a constant height, leading, trailing and top layout guide constraints. This will allow this view to remain in place while the navigation controller performs its normal transitions in which navigation bars are replaced with that slide/fade animation. To adjust the content in each view controller pushed onto the navigation controller, adjust insets or top layout guide constraints.
Hi I am developing small Iphone application in which I am giving colour for my navigation bar like this
[self.navigationController.navigationBar setTranslucent:NO];
[self.navigationController.navigationBar setBarTintColor:[UIColor redColor]];
But because of this my status bar also become of red colour. I want to change it to white. I tried in followings way but those are not working for me.
in info.plist file I set View controller-based status bar appearance = "NO"
then in application:didFinishLaunchingWithOptions: set [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
Then in UIViewcontroller
- (UIStatusBarStyle)preferredStatusBarStyle
{
return UIStatusBarStyleLightContent;
}
But above methods are not working for me. My navigation bar and status bar of same colour. I want to make status bar colour to white. My application is very simple having one UIView controller with one navigation controller. Am I doing some thing wrong? Need Help. Thank you .
UIStatusBarStyleLightContent tells the status bar to display light colored text, but it is still transparent. And because the navigation controller reports the position of its navigation bar to be UIBarPositionTopAttached, you see the effect of the navigation bar's color stretching beneath the status bar.
Here are two ideas how to achieve what you are looking for:
Subclass the navigation controller, implement - (UIBarPosition)positionForBar:(id<UIBarPositioning>)bar and return UIBarPositionTop. This make the navigation bar not stretch beneath the status bar, and instead the superview of the navigation bar (which is usually white), will show.
Or, better, subclass the navigation controller, add a subview of 20pt height above the navigation bar, and in viewDidLayoutSubviews, position and resize the subview correctly to orientation. Now you can give any color you'd like to this view, and it will be the color of the status bar.
Edit: Based on the comments, the positionForBar: approach may not work.
I want to show a download progress bar beneath the status bar by either placing it on top of all other views (hiding whats under it) or by squeezing the rest. The bar will only be 9 px high. How can I do this?
If your application uses default navigation bar then you can't able to show progress bar beneath the status bar as navigation bar position is default at top of the view. You cant change that. But if you want to show progress bar with navigation bar then you need to customized the navigation bar.
And if your application doesn't have navigation bar then you can directly use progress bar on top of the view so that it will appear exact below to the status bar. Hope this will help you.
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
I've added a tab bar controller to my app delegate. In IB, I adjusted the alpha property and unchecked opaque, however in the simulator I get transparency over a white background, even though there should be content below it.
Perhaps, the containing View needs to be resized to the full dimensions of the screen? I'm using a nav controller with a tableview in this tab bar item.
What? You want your UITabBar to be translucent? A UITabBar is not a subclass of UINavigationBar, therefore the content from any view controllers the tab controller manages will not appear under the tab bar, if that's what you're trying to do.