2

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?

Rameez Hussain
  • 6,414
  • 10
  • 56
  • 85

4 Answers4

2

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

enter image description here

1

Try to change the following properties for your UIViewControllers for elimination pixels shift effect for iOS7.

enter image description here

Wisors
  • 640
  • 6
  • 15
0

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.

Prince Agrawal
  • 3,619
  • 3
  • 26
  • 41
  • 1
    This 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
0

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

Community
  • 1
  • 1
Ethan Fang
  • 1,271
  • 10
  • 15