I am trying to get my UINavigationBar
and UIStatusBar
to be opaque and have no translucency properties whatsoever. I tried using [[UINavigationBar appearance] setTranslucent:NO];
but that moves the view content down a few pixels. I want that content to be under the UINavigationBar
. Is there an easy way to do this?

- 6,414
- 10
- 56
- 85
-
1Do you use Autolayout? – Robert Jan 25 '14 at 12:01
-
No I don't. I've disabled it for all my ViewControllers. – Rameez Hussain Jan 25 '14 at 12:05
-
If i understood you good, you want on iOS7 move down viewController under statusBar? – Robert Jan 25 '14 at 12:16
-
Yes. I want the content to be able to scroll under the UINavigationBar. Like it does on Facebook and Instagram apps. They have opaque navbars. Also, I am trying to achieve the same kind of navbar movement (up/down) they have. – Rameez Hussain Jan 25 '14 at 12:21
-
What's the point of having content underneath the nav bar if it's opaque? The reason your content moves down slightly is so that it's all visible. – Stephen Darlington Dec 16 '15 at 13:44
4 Answers
I had the same problem when I used [[UINavigationBar appearance] setTranslucent:NO]; on AppDelegate.m . What worked for me: set "Under Opaque Bars" (see image) property in each ViewController scene under that opaque Navigation Bar

- 101
- 2
- 4
Try to change the following properties for your UIViewControllers for elimination pixels shift effect for iOS7.

- 640
- 6
- 15
First of all, translucent property just can't be set using UIAppearance
. Next there is no relation between whether your bars are translucent or opaque & the changed positions of your pixels.
Customizing the Appearance of a Navigation Bar
In iOS 7, a navigation bar’s tintColor affects the color of the back indicator image, button titles, and button images. The barTintColor property affects the color of the bar itself. Additionally, navigation bars are translucent by default. Turning the translucency off or on does not affect buttons, since they do not have backgrounds.

- 3,619
- 3
- 26
- 41
-
1This seems to be referring to the subviews of the navigation bar itself. I am talking about the actual content of the UIViewController. The content gets pushed down by around 64 pixels when the setTranslucent:NO method is called on the navbar. – Rameez Hussain Jan 25 '14 at 13:11
In my IOS app, I need to do the following in - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
function
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"7.0")) {
[application setStatusBarStyle:UIStatusBarStyleLightContent];
self.window.clipsToBounds =YES;
self.window.frame = CGRectMake(0,20,self.window.frame.size.width,self.window.frame.size.height-20);
//Added on 19th Sep 2013
self.window.bounds = CGRectMake(0, 20, self.window.frame.size.width, self.window.frame.size.height);
}
There is a more detailed discussions here ios-7-status-bar-back-to-ios-6-style

- 1
- 1

- 1,271
- 10
- 15