UIButton setTitleColor,RGB值不起作用

tri*_*eni 4 iphone

我必须将ffe1b1的标题颜色设置为UIButton.RGB值为ffe1b1为255,225,177.我正在尝试这个代码,但它没有正确反映.我在网上搜索颜色组件是介于0.0和1.0之间的浮点数!那么什么是给出RGB值的正确方法.谢谢

   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];
Run Code Online (Sandbox Code Playgroud)

Ila*_*ian 10

像这样改变这条线

[btn setTitleColor:[UIColor colorWithRed:255.0 green:225.0 blue:177.0 alpha:0.6 ]forState: UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)

[btn setTitleColor:[UIColor colorWithRed:(255.0/255) green:(225.0/255) blue:(177.0/255) alpha:0.6 ]forState: UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)