其他分享
首页 > 其他分享> > ios改变UITextField的placeholder的颜色

ios改变UITextField的placeholder的颜色

作者:互联网

_txtF = [[UITextField alloc]initWithFrame:CGRectMake(0, 100, self.view.width, 30)];
_txtF.font = KFONT_14;
NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:@"请输入内容" attributes:
    @{NSForegroundColorAttributeName:[UIColor redColor],
                    NSFontAttributeName:_txtF.font
    }];
_txtF.attributedPlaceholder = attrString;
[self.view addSubview:_txtF];

 

标签:alloc,attrString,NSAttributedString,txtF,ios,UITextField,font,placeholder,self
来源: https://www.cnblogs.com/zk1947/p/12845553.html