Move navigation bar in navigation view controller in ios7 - ios

I want add 20 points margin to my navigation bar. I need it because I want another background color under status bar as youtube did:
I found
iOS Developer library says: Status bar background appearance provided by the window background, if using UIBarPositionTop.
I found solution for toolbar, but I can't move my navigation bar inside navigation view controller. I just set UIBarPositionTop for my navigation bar, but it changes nothing.
-(UIBarPosition)positionForBar:(id<UIBarPositioning>)bar {
NSLog(#"position method called");
return UIBarPositionTop;
}
I still see the gray background of status bar instead of white.
Is it possible to do it with a navigation bar or should I use a view with a toolbar?
(XCode 6, development target 7.0+, sdk 8.0, autolayout)
UPDATE: ANOTHER WAY TO RESOLVE PROBLEM
I read this question
and understood, that there is no need to add margin. I added view with background color I need over my navigation bar controller and it resolved my problem.

When you are adding your UIView to the UIWindow, you should change the UIViews size to not underlap the title bar. How to do this is well documented in this post:
Offset on UIWindow addSubview

I hope i understood correctly, look in size inspector, ios 6/7 deltas.
Check this link for an explanation:
Interface Builder: What are the UIView's Layout iOS 6/7 Deltas for?

Related

Achieving iOS 7.1 UINavigationBar blur

I have another UIView under the navigation bar like this.
I want the slight blur of the navigation bar for that UIView too. Currently I have its alpha value reduced but it doesn't give the desired effect as you can see.
How can I get the frosty look of the navigation bar for the UIView as well? I'm on iOS 7.1.
Don't use a UIView - you will never achieve a consistent result with the navigation bar.
Use a UIToolbar and place it below the navigation bar. Set the delegate of the toolbar to your view controller and implement positionForBar: to return UIBarPositionTop or UIBarPositionTopAttached. You can then add all the subviews you have in your view to the toolbar.
you can use UIToolbar, it's the quickest way.
If you want to customize it, you have to use 3rd library like ILTrasparentView, FXBlurView ...

iOS 7 - Status bar overlaps the view content

I am using status bar in my app and wanted to maintain the compatibility between ios 6 and ios 7. I wanted status bar to behave same as ios 6. I don't want status bar to overlap view controllers.
Try adding the following code in your view's viewWillAppear function:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
// if this is ios7 this code will make the view appear properly below the navigation bar
if ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0) {
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = YES;
}
}
Try this~
if(OVER_IOS7){
self.edgesForExtendedLayout = UIRectEdgeNone;
[self.navigationController.navigationBar setTranslucent:NO]
}
Try this.
add this key into info.plist file
View controller-based status bar appearance
set value for this to:- No
In iOS 7, the status bar is transparent, and other bars—that is, navigation bars, tab bars, toolbars, search bars, and scope bars—are translucent. As a general rule, you want to make sure that content fills the area behind the bars in your app.
Most bars also draw a blur behind them, unless you provide a custom background image for the bar.
iOS 7 introduces the barPosition property for identifying bar position, which helps you specify when a custom background image should extend behind the status bar. The UIBarPositionTopAttached value means that a bar is at the top of the screen and its background extends upward into the status bar area. In contrast, the UIBarPositionTop value means that a bar is at the top of its local context—for example, at the top of a popover—and that it doesn’t provide a background for the status bar.
By default, all bar buttons are borderless. For details, see Bar Buttons.
The Status Bar
Because the status bar is transparent, the view behind it shows through. The style of the status bar refers to the appearance of its content, which includes items such as time, battery charge, and Wi-Fi signal. Use a UIStatusBarStyle constant to specify whether the status bar content should be dark (UIStatusBarStyleDefault) or light (UIStatusBarStyleLightContent):
UIStatusBarStyleDefault displays dark content. Use when light content is behind the status bar. image: ../Art/status_bar_default_iphone_2x.pngimage: ../Art/status_bar_default_ipad_2x.png
UIStatusBarStyleLightContent displays light content. Use when dark content is behind the status bar. image: ../Art/status_bar_light_iphone_2x.pngimage: ../Art/status_bar_light_ipad_2x.png
In some cases, the background image for a navigation bar or a search bar can extend up behind the status bar (for details, see Navigation Bar and Search Bar and Scope Bar). If there are no bars below the status bar, the content view should use the full height of the screen. To learn how to ensure that a view controller lays out its views properly, see Using View Controllers.
In iOS 7, you can control the style of the status bar from an individual view controller and change it while the app runs. If you prefer to opt out of this behavior and set the status bar style by using the UIApplication statusBarStyle method, add the UIViewControllerBasedStatusBarAppearance key to an app’s Info.plist file and give it the value NO.

UINavigationController toolbar 100% transparent

In a storyboard I create a ![UINavigationController] with its root view controller a UIViewcontroller. In the toolbar I have a segmented control. I made it transparent, but only has the normal tint, I expect to see the normal background or the table view blurred under it, but its 100% transparent for some reason.
This is a known bug in iOS7, when presenting a popover from a bar button item.
First open a bug report so Apple gives this issue more priority.
As a workaround, make sure to set the edges for extended layout to none for view controllers inside popovers. For reference, you can see in Apple's calendar app they also do this. There is no translucency under popover navigation bars and toolbars.

How to increase the height of the navigation bar and change the vertical position of the title using xcode 5 (iOS7)?

I developed a simple app for iOS6 and now I'm to updating its appearence for iOS7. One of the first changes I would like to do concerns the navigation bar.
I'm using the standard navigation bar UI component that comes with xcode. While in iOS6 the navigation bar was clearly placed under the status bar (i.e. battery, carrier and hour), in iOS7 the navigation bar blends with the status bar.
My question is: how can I increase the height of the navigation bar and place the title vertically a little lower than the default position?
Currently I have this:
And the title is too close to the time. I would like to achieve this (standard Photos app that comes with iOS7):
here the title of the bar is lower and the bar is larger (or is just shifted down).
It have been trying to modify the height of the navigation bar through the size inspector but with no success.
It's probaly a very easy issue to solve, however I'm still new to xcode development and I can't figure it out.
Stick the view controller in a Navigation Controller, that should immediately solve the problem

Change statusbar tint colour

Is there a way to set the status bar tint colour?
I have my navigationbar tint set to brown and when it's on screen it also changes the statusbar to brown, however on views that I hide the navigationbar the statusbar returns to its original colour.
How can I change the statusbar tint colour to persist trough the application?
There is no way in iOS 5. You can just change your bar style.
But if you take a look at new WWDC 2012 Sessions, you may find something interesting)
Session number 216 - Advanced Appearance Customization on iOS
Maybe keep the notification bar there but cover it up? If the notification bar's color influences that of the status bar, then it would lead me to believe that it just has to be in the window (even buried under another view) to change it.
There is no way in iOS 5 or ealier version of ios.
now ios 6 have feature to change status bar tint color or it will set according to navigation bar pattern Image
But u can use Custom Status Bar
What I do in screens that have no navigation bar is to put in a navigation bar at the top but behind the visible interface. The navigation bar is not visible to the user, but it is visible to the system and causes the status bar to adopt its color.
EDIT: Sorry, I see now that someone else had already suggested this. So I'm just confirming that it does work.

Resources