aveschini
aveschini

Reputation: 1712

iOs: How to change color of "more" back button when having more than 5 tabs

I have an application with 6 tabs, so the system automatically generates the first 4 tabs and a fifth tab called "Altro" ("More" in italian) that contains the previous fifth and sixth tab content.

This is ok. The problem is that i don't know how to change the color of the back button when going through the "altro" tab. Any advice?

Some screenshot for a better explanation of the problem:

Orange back button

Altro tab

Blue back button

Upvotes: 0

Views: 158

Answers (2)

Hari1251
Hari1251

Reputation: 452

UIImage *buttonImage = [UIImage imageNamed:@"back_btn.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:buttonImage forState:UIControlStateNormal];
button.frame = CGRectMake(0, 0, buttonImage.size.width/2, buttonImage.size.height/2);
[button addTarget:self action:@selector(backPressed) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *customBarItem = [[UIBarButtonItem alloc] initWithCustomView:button];
self.navigationItem.leftBarButtonItem = customBarItem;

Try this.......once

Upvotes: 1

Rajan Balana
Rajan Balana

Reputation: 3815

You can change the color of backButton using the following code:

self.navigationItem.backBarButtonItem.tintColor = [UIColor redColor];

Upvotes: 0

Related Questions