swift修改UITextfield的Placeholder字体大小和颜色
发布日期:2021-05-09 04:04:54 浏览次数:20 分类:博客文章

本文共 490 字,大约阅读时间需要 1 分钟。

 

第一种方法:

self.userNumber.setValue(UIColor.lightGray, forKey: "_placeholderLabel.textColor")self.userNumber.setValue(UIFont.systemFont(ofSize: 15), forKeyPath: "_placeholderLabel.font")

  

第二种方法:

//字体大小  textField.attributedPlaceholder = NSAttributedString.init(string:"输入你需要的服务", attributes: [NSFontAttributeName:UIFont.systemFont(ofSize:15)])  //字体颜色  textField.attributedPlaceholder = NSAttributedString.init(string:"输入你需要的服务", attributes: [  NSForegroundColorAttributeName:UIColor.red])

  

 

上一篇:MR单元测试以及DeBug调试
下一篇:【iOS开发】Alamofire框架的使用二 高级用法

发表评论

最新留言

路过按个爪印,很不错,赞一个!
[***.219.124.196]2025年03月24日 02时47分23秒