我必須將ffe1b1的標題顏色設置爲ffe1b1的UIButton.RGB值爲255,225,177。 我正在嘗試此代碼,但它沒有正確反映。我在網上搜索顏色組件漂浮在0.0和1.0之間! 那麼,什麼是給了這RGB Values.ThanksUIButton setTitleColor與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];
只是一個猜測:你有沒有試過將你的值除以256.0? –