1
votes

I am trying to get a nice translucent dark navigation bar for my view. The background image is a nice black and white, so the automatic translucency in the app should be enough, but when I run the app, I get an almost 100% opaque white navigation bar.

I have reviewed many of the questions on the site and tried much of the provided answers without luck, I have looked at this:

Achieving bright, vivid colors for an iOS 7 translucent UINavigationBar'

and this

http://www.appcoda.com/customize-navigation-status-bar-ios-7/

But I still don't get the solution I am seeking, the closes I got was when the view initially appears it has the right levels, as soon as the segue comes to an end, the navigation bar becomes completely opaque. This is the code that I am trying to work with right now:

 self.navigationController.navigationBar.alpha= .8f;
    self.navigationController.navigationBar.barTintColor = [UIColor blackColor];
    self.navigationController.navigationBar.translucent = YES;

and this is the the result I am getting:

enter image description here

Strangely enough, as I mentioned when the segue is presenting the view, the navigation bar has one look and when it is completely presented it has a completely different appearance, see images:

This is before the view fully loads:

enter image description here

and this is right after it has been fully loaded:

enter image description here

I would really appreciate some help, thank you.

EDIT: I tried the following code with no success :

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      // Override point for customization after application launch.

      [[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];

      return YES;
    }
2

2 Answers

0
votes

If you want this style for all the nag bars in your application then i suggest you set the Navigation bar style via the appearance proxy.

In your AppDelegate.m (or whatever your app delegate file is) replace the didFinishLaunchingWithOptions: method with the one below

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
      // Override point for customization after application launch.

      [[UINavigationBar appearance] setBarStyle:UIBarStyleBlackTranslucent];

      return YES;
    }

Use UIBarStyleDefault for the usual light translucent bar.

Try this and tell me if it works

0
votes

I believe this has been a problem since iOS 7.0.3. Try This. Use the color you used before but set the alpha = 0.67.

UIColor * navColor = ...; self.navigationBar.barTintColor = [navColor colorWithAlphaComponent:0.67];