textFiled的placeHolder字体颜色

self.title=@"修改UITextField的placeholder字体颜色";

UITextField *textTF=[[UITextField alloc]initWithFrame:CGRectMake(20,130,300,30)];

textTF.placeholder=@"修改UITextField的placeholder字体颜色";

//    // 一种方式

//    [textTF setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];

// 第二种方式

textTF.attributedPlaceholder=[[NSAttributedString alloc]initWithString:@"修改UITextField的placeholder字体颜色" attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];

[self.view addSubview:textTF];

上一篇:MySort实验报告


下一篇:java中StringUtils中isEmpty 和isBlank的区别