设置textfield的placeholder的字体和颜色
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 30, 300, 150)];
textField.placeholder = @"this is a textField";
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"];
[textField setValue:[UIFont boldSystemFontOfSize:30] forKeyPath:@"_placeholderLabel.font"];
textField.borderStyle = UITextBorderStyleRoundedRect;
[self.view addSubview:textField];
本文介绍如何使用Swift在iOS应用中自定义UITextField的占位符文本的颜色和字体大小,通过设置_keyPath属性实现样式调整。
124

被折叠的 条评论
为什么被折叠?



