美文网首页
ios UITextField 的 placeholder 的

ios UITextField 的 placeholder 的

作者: 万忍 | 来源:发表于2017-02-19 20:35 被阅读89次

UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(0, 0, 200, 200)];

NSString *holderText = @"标哥的技术博客";

NSMutableAttributedString *placeholder = [[NSMutableAttributedString alloc]initWithString:holderText];

[placeholder addAttribute:NSForegroundColorAttributeName

value:[UIColor redColor]

range:NSMakeRange(0, holderText.length)];

[placeholder addAttribute:NSFontAttributeName

value:[UIFont boldSystemFontOfSize:16]

range:NSMakeRange(0, holderText.length)];

textField.attributedPlaceholder = placeholder;

[self.view addSubview:textField];

相关文章

网友评论

      本文标题:ios UITextField 的 placeholder 的

      本文链接:https://www.haomeiwen.com/subject/qhgjwttx.html