Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Translucent UINavigationBar

I'm having trouble making my UINavigationBar completely transparent with only the white text & buttons to be shown on it, so that the ImageView I use for ViewController background is completely visible at the top.

I've tried this code amongst other:

    // Set the BarTintColor to translucent and text colors to white
self.navigationController.navigationBar.barTintColor = [UIColor clearColor];
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:UITextAttributeTextColor];
self.navigationController.navigationBar.tintColor = [UIColor whiteColor];

But this is the result, a blackish UINavigationBar, how can I solve this?

The app pushes over from this ViewController to this ViewController where the UINavigationBar fades over to red. There are several other ViewControllers doing the same fade animation, so the UINavigationBar is required

The part of the first ViewController with the "Ny" button will be improved;) - just working on getting my hands on a tool like Photoshop

Thanks! Erik

like image 338
Erik Avatar asked Sep 11 '14 12:09

Erik


People also ask

How do I make my navigation bar translucent?

You need to do three things to make a navigation bar transparent. Set background image to non-nil empty image ( UIImage() ). Set shadow image to non-nil empty image ( UIImage() ). Set isTranslucent to true .

What is isTranslucent?

A Boolean value that indicates whether the navigation bar is translucent.

What is Navigationitem?

The navigation item used to represent the view controller in a parent's navigation bar.

How do you make navigation bar transparent in react native?

I was able to get the nav bar transparency using the #AARRGGBB pattern specified in the docs.


2 Answers

This is what I use to make the navigation bar transparent:

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.translucent = YES;
like image 176
iOS Dev Avatar answered Oct 10 '22 21:10

iOS Dev


add this

self. navigationController.navigationBar.translucent = YES;
like image 23
Shahab Qureshi Avatar answered Oct 10 '22 20:10

Shahab Qureshi