Kuldeep1007tanwar Kuldeep1007tanwar - 5 months ago 17
Objective-C Question

Removing Title From Navigational Bar

I'm working with Navigational Controller and I want to remove the title of the previous page that is on the NavigationalBar like this:-

enter image description here

Answer

1

You can also change it with this line of code:

[self.navigationItem.backBarButtonItem setTitle:@"Title here"];

if you like to set back button title is blank...then just instead of Title here put there only space

2

or do like this:

UIBarButtonItem *btn = [[UIBarButtonItem alloc]init];
btn.title=@"";
self.navigationItem.leftBarButtonItem=btn;

3

Select navigation item from interface builder and change the Back Button string to what you'd like the back button to appear as. If you want it blank then just put a space.

For title color

1

    NSDictionary *titlecolor =@{
NSForegroundColorAttributeName : [UIColor whiteColor]
                               };

Assign the dictionary

    [[self navigationItem] setTitle:@"Your Title"];
self.navigationController.navigationBar.titleTextAttributes = titlecolor;

2

Suppose you want redColor

self.navigationController.navigationBar.titleTextAttributes = [NSDictionary dictionaryWithObject:[UIColor redColor] forKey:NSForegroundColorAttributeName];

For Background Color

[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:107.0/256.0 green:145.0/256.0 blue:35.0/256.0 alpha:1.0]]; 
Comments