ios - How to set UIBarButtonItem tintcolor to non default UIColor -


i've looked through typical navigation bar tintcolor tutorials , questions. have set tint navigation bar, have mail icon needs change custom color when there mail. (like reddit orange mail icon)

i can set tint when using system uicolors.

self.leftnavigationbarbutton = [[uibarbuttonitem alloc] initwithimage:someimage style:uibarbuttonitemstyleplain target:self action:@selector(foo:)]; self.navigationitem.leftbarbuttonitem = self.leftnavigationbarbutton;  self.leftnavigationbarbutton.tintcolor = [uicolor redcolor]; 

however if use custom color.

self.leftnavigationbarbutton.tintcolor = [uicolor colorwithred:100 green:40 blue:20 alpha:1.0]; 

it makes icon white. know what's going on or how can use custom color?

i figured out answer https://stackoverflow.com/a/5642229/1732711.

short answer divide rgb values 255.0.

self.leftnavigationbarbutton.tintcolor = [uicolor colorwithred:100/255.0 green:40/255.0 blue:20/255.0 alpha:1.0]; 

Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -