textFiled的placeHolder字体颜色

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];

相关文章
相关标签/搜索