Reputation: 5186
I have develop the my iPad application in ios6 but now i want to develop that application in ios7 also , I am using .xib file and I am not using the AutoLayout i want to use the black status bar in my application and i want to make the application similar like ios 6 but the status bar is overlap on the view i use the different code like below link
Link 1 Position of navigation bar for modal view - iOS7
Link 2 iOS 7 - Status bar overlaps the view
Thanks in Advance
Upvotes: 1
Views: 7817
Reputation: 1586
A workaround to use the old style status bar is to modify the frame of the main view and shift it down 20px. This will only work on viewWillAppear function but you need to make sure you call this once. This is more of a hack than a solution:
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.view setFrame: CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y+20, self.view.frame.size.width, self.view.frame.size.height-20)];
}
Upvotes: 1
Reputation: 6766
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.
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.
UIStatusBarStyleLightContent
displays light content. Use when dark content is behind the status bar.
In some cases, the background image for a navigation bar or a search bar can extend up behind the status bar. If there are no bars below the status bar, the content view should use the full height of the screen.
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 behaviour 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
.
For more details about how to use status bar with navigation controller, please refer my answer here.
Upvotes: 2
Reputation: 50089
wont happen, two options:
OR
Upvotes: 3
Reputation: 1435
Try below to do not overwrite status bar:
[navController.navigationBar setBackgroundImage:[UIImage imageNamed:@"navBar.png"] forBarPosition:UIBarPositionTop barMetrics:UIBarMetricsDefault];
Upvotes: 1