2017-03-18 29 views
1

當我設置任何UI的顏色,如文本字段佔位符顏色或滑塊最大和最小色調RGB格式時,它不顯示任何顏色,但是就像一個清晰的顏色。當我將RGB的紅色變爲0時,它顯示綠色和藍色的混合顏色。但是當我將RGB的紅色值增加到1時,它會變得微弱,並且在1時,它是不可見的。我的代碼是 設置滑動條顏色以RGB格式設置任何UI的顏色

[_sliderSpeed setMaximumTrackTintColor:[UIColor colorWithRed:181 green:217 blue:255 alpha:1]]; 

設置文本字段佔位符顏色

NSAttributedString *pin = [[NSAttributedString alloc] initWithString:@"Add pin" attributes:@{ NSForegroundColorAttributeName : [UIColor colorWithRed:0 green:103 blue:169 alpha:1] }]; 
self.pin.attributedPlaceholder = pin; 

請幫助我。

回答

4

它應該是這樣的

[_sliderSpeed setMaximumTrackTintColor:[UIColor colorWithRed:(181/255.0) green:(217/255.0) blue:(255/255.0) alpha:1] ;//set your color here 

對於參考:

https://stackoverflow.com/a/10379026

+0

非常感謝。有效。 –

+0

@NituWarjurkar歡迎 –