1
votes

The background color for my view in RGB format is R: 111/255 G: 209/255 B: 229/255

I tried setting the tint of the UIBarButtonItem using:

CGFloat nRed=111.0/255.0;
CGFloat nGreen=209.0/255.0;
CGFloat nBlue=229/255.0;
UIColor *myColor=[[UIColor alloc]initWithRed:nRed green:nBlue blue:nGreen alpha:1];
[[UIBarButtonItem appearance] setTintColor:myColor];

The color does change for all the UIBarButtonItems I have in the project...but it is still noticeably different from the color of my background. Any thoughts?

1
What's the name of the button you're trying to change? '[UIBarButtonItem appearance]' applies the settings to all. Is it leftBarButtonItem, rightBarButtonItem, or backBarbuttonItem?jhilgert00
as for the color difference, I always specify a float for my values, like so: nBlue = 229.0f/255.0f, instead of just the numbers. Works for me.jhilgert00
you are passing nBlue to green and nGreen to blue :)flagg19

1 Answers

0
votes

You don't need to call the appearance method. Just do this:

//Suppose you have a variable barButtonItem
barButtonItem.tintColor = [UIColor blueColor];