I need to set custom colors to my UINavigationBar buttons. I'm doing the following thing(RGB func is a define):
- (void)viewWillAppear:(BOOL)animated
{
for (UIView *view in self.navigationController.navigationBar.subviews)
if ([[[view class] description] isEqualToString:@"UINavigationButton"])
[(UINavigationButton *)view setTintColor:RGB(22.0,38.0,111.0)];
}
Everything looks fine on app load. after leaving the view and getting back the color returns to default.
Secondly I need to set the same colour to UISegmentedControl to a pressed button.
[Change UINavigationItem colour](http://www.skylarcantu.com/blog/2009/11/05/changing-colors-of-uinavigationbarbuttons/"Changing colors of UINavigationBarButtons") and to set same color to UISegmentControl will help you to reach to your destination.
Here is a sample code for to set color to UISegmentControl.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With