ios UITextField 的 placeholder 的设置

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 的设置)