2016-01-22 48 views
0

我试过搞乱红色,绿色,蓝色的个人价值观。但似乎无法获得正确的颜色。Objective-C:textfields占位符文本的实际颜色是多少?

e.g

[UIColor colorWithRed:0.80 green:0.80 blue:0.80 alpha:1.0]; 

感谢

编辑

感谢萨蒂什一种用于把我推在正确的方向。

UITextField.placeholder的的UIColor,我得到的是

[UIColor colorWithRed:196.0/255.0 green:193.0/255.0 blue:110.0/255.0 alpha:1.0] 

回答

0

尝试以下操作:

覆盖drawPlaceholderInRect:(CGRect)rect这样手动呈现占位符文本:

- (void) drawPlaceholderInRect:(CGRect)rect { 
    [[UIColor blueColor] setFill]; 
    [[self placeholder] drawInRect:rect withFont:[UIFont systemFontOfSize:16]]; 
} 

OR

[self.placeholder drawInRect:rect withFont:self.font lineBreakMode:UILineBreakModeTailTruncation alignment:self.textAlignment];