I Have to set Title color for ffe1b1 to a UIButton.RGB value of ffe1b1 is 255,225,177. I am trying this code, but its not properly reflect. I search on net Color components are floats between 0.0 and 1.0 ! So what is proper way for giving That RGB Values.Thanks
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom] ;
btn.frame = CGRectMake(134.0, 193.0, 80.0, 30.0);
[btn setBackgroundImage:img forState:UIControlStateNormal];
[btn setTitle:@"Contact" forState:UIControlStateNormal];
[btn setTitleColor:[UIColor colorWithRed:255.0 green:225.0 blue:177.0 alpha:0.6 ]forState: UIControlStateNormal];
Change the line like this
[btn setTitleColor:[UIColor colorWithRed:255.0 green:225.0 blue:177.0 alpha:0.6 ]forState: UIControlStateNormal];
to
[btn setTitleColor:[UIColor colorWithRed:(255.0/255) green:(225.0/255) blue:(177.0/255) alpha:0.6 ]forState: UIControlStateNormal];
in objective c you cannot directly use RGB values. follow this link: http://www.touch-code-magazine.com/web-color-to-uicolor-convertor/
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