修改UITextField输入字符颜色

2016-11-18  本文已影响19人  路这么长
用法👇
   cell.upField.attributedPlaceholder = [self changePlaceholderColorwith:@"请输入用户名" Range:NSMakeRange(0, 6)];

- (NSMutableAttributedString *)changePlaceholderColorwith:(NSString *)str Range:(NSRange)range{       

NSMutableAttributedString *attrString = [[NSMutableAttributedString alloc]initWithString:str];   
 [attrString addAttribute:NSForegroundColorAttributeName  value:[UIColor colorWithHexString:@"#999999"]  range:range];   
  return attrString;
}
上一篇 下一篇

猜你喜欢

热点阅读