self.title=@"修改UITextField的placeholder字體顏色";字體
UITextField *textTF=[[UITextField alloc]initWithFrame:CGRectMake(20,130,300,30)];it
textTF.placeholder=@"修改UITextField的placeholder字體顏色";view
// // 一種方式vi
// [textTF setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];顏色
// 第二種方式placeholder
textTF.attributedPlaceholder=[[NSAttributedString alloc]initWithString:@"修改UITextField的placeholder字體顏色" attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];ab
[self.view addSubview:textTF];