UITextField占位符

self.userName.attributedPlaceholder= [[NSAttributedStringalloc]initWithString:@"请输入用户名"attributes:@{NSForegroundColorAttributeName:[UIColorgrayColor],NSFontAttributeName:[UIFontsystemFontOfSize:18]}];

self.password.attributedPlaceholder= [[NSAttributedStringalloc]initWithString:@"请输入密码"attributes:@{NSForegroundColorAttributeName:[UIColorgrayColor],NSFontAttributeName:[UIFontsystemFontOfSize:18]}];

[_textFieldsetValue:[UIFontboldSystemFontOfSize:16]forKeyPath:@"_placeholderLabel.font"];

你可能感兴趣的:(UITextField占位符)