设置textField的placegolder的字体大小和字体颜色

       由于项目的主题颜色为灰黑色,所以当使用textField的时候,placeholder内的字体默认是灰色,当程序执行的时候,差点儿看不到.

       翻来翻去找到一种比較简单地方法,仅仅须要复制以下三行代码就可以.

      self.ttt.placeholder = @"请输入username!";

      [self.tttsetValue:[UIColorredColor forKeyPath:@"_placeholderLabel.textColor"];

      [self.tttsetValue:[UIFontboldSystemFontOfSize:15 forKeyPath:@"_placeholderLabel.font"];

     小小demo

  
posted @ 2018-04-01 17:34  zhchoutai  阅读(387)  评论(0编辑  收藏  举报