Nilesh Tupe
Nilesh Tupe

Reputation: 7803

IOS Changing the color of back button

I could find 2 methods to change the back button of navigation bar

1)[self.navigationItem.backBarButtonItem setTintColor:[UIColor colorWithRed:0 green:0.3294 blue:0.5764 alpha:1]]; though looking simple this method is not working..dont know why?

2)[[UIBarButtonItem appearance] setTintColor:[UIColor colorWithRed:0 green:0.3294 blue:0.5764 alpha:1]]; This method is working fine on IOS5..But this method is not present in lower versions thus causing the application to crash.

Is there any way out to change color of back bar button?

Upvotes: 1

Views: 1974

Answers (1)

Mike
Mike

Reputation: 1219

backBarButtonItem on navigationItem is a UIBarButtonItem and its color can be set via the tint color property, available in iOS 5 or later.

Alternate solution in iOS 4: Set self.navigationController.navigationBar.tintColor, which, from iOS 2 up will set your back button color as the same.

Refer to this for more information:

Upvotes: 1

Related Questions