1

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

tryKuldeepTanwar
  • 3,490
  • 2
  • 19
  • 49
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/113994/discussion-between-ei-captain-v2-0-and-kuldeep1007tanwar). – Bhavin Bhadani Jun 07 '16 at 08:04

3 Answers3

2

You can remove navigation title from NavigationBar with this line of code:

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

Hope it would help you.

Bhumika
  • 876
  • 7
  • 20
2

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]]; 
Suraj Sukale
  • 1,778
  • 1
  • 12
  • 19
  • hey brother I'm also struggling with background color , I want to apply custom color so I use - "self.navigationController.navigationBar.backgroundColor=[UIColor colorWithRed:62.0f/255.0f green:165.0f/255.0f blue:254.0f/255.0f alpha:1.0] CGColor];" but it's not working any Idea @Suraj Sukale – tryKuldeepTanwar Jun 07 '16 at 07:01
  • and how am I suppose to make that button work suppose I Put @" < " but it will not work because it's just a string soo how can I go back? @Suraj Sukale – tryKuldeepTanwar Jun 07 '16 at 07:05
  • also color seems like gradient i want to apply plane color @Suraj Sukale – tryKuldeepTanwar Jun 07 '16 at 07:22
1

You need to set empty title for your navigation bar item button title You can try this

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

OR

You can also assign a new button to your navigation bar item button

UIBarButtonItem *myButton = 
        [[UIBarButtonItem alloc] initWithTitle:@" " 
                                         style:UIBarButtonItemStyleBordered 
                                        target:nil 
                                        action:nil];
[[self navigationItem] setBackBarButtonItem:myButton];
Bhumika
  • 876
  • 7
  • 20
hites
  • 149
  • 1
  • 7
  • i found this working but it removed the back button any suggestion on that-""UIBarButtonItem *btn = [[UIBarButtonItem alloc]init]; btn.title=@""; self.navigationItem.leftBarButtonItem=btn;"" – tryKuldeepTanwar Jun 07 '16 at 06:41
  • Here you have assigned a new button so, you need to make a method and call that method on the target of this(myButton) button. – hites Jun 07 '16 at 06:48
  • how am I suppose to make that back button appear? @hites – tryKuldeepTanwar Jun 07 '16 at 06:50