user1960169
user1960169

Reputation: 3653

NAvigation bar not appear

I want to make my NavigationbarClear color. So I tried like this in my ViewDidLoad

self.navigationController.navigationBar.hidden=NO;

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage=[UIImage new];

self.navigationController.navigationBar.translucent=YES;

self.navigationController.navigationBar.topItem.titleView.tintColor=[UIColor blackColor];
self.navigationController.navigationBar.topItem.title=[lan GetConvertedLanguageString:@"My Profile"];
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName];



self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"backarrow"] style:UIBarButtonItemStylePlain target:self action:@selector(revealToggle :)];
[self.navigationController navigationBar].tintColor = [UIColor whiteColor];

But nothing visible in my view controller. Whats wrong with this code? Please help me. Thanks

Upvotes: 1

Views: 33

Answers (2)

Rushang Prajapati
Rushang Prajapati

Reputation: 596

Check this image Pick up navigation controller scene and then pickup navigationbar (see in pic) after that set the clear color from showutilites>attribute insepecter also you can change title color from here

Upvotes: 1

Leo
Leo

Reputation: 24714

Screenshot

Code

[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault];
self.navigationController.navigationBar.shadowImage=[UIImage new];
self.navigationItem.title = @"1234";
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Left" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor whiteColor] forKey:NSForegroundColorAttributeName]; 
[self.navigationController navigationBar].tintColor = [UIColor whiteColor];

So,I guess,your background of View is White,so you cannot see white text.

Note

navigationBar.titleTextAttributes

Display attributes for the bar’s title text.

navigationBar.tintColor

The tint color to apply to the navigation items and bar button items.

Upvotes: 0

Related Questions