占位符的字体的颜色,大小设置。
UITextField *textField = [[UITextField alloc] init];
UIFont *font = [UIFont systemFontOfSize:12];
UIColor *color =[UIColor whiteColor];
textField.textAlignment = NSTextAlignmentCenter;
// 没错,就是看接下来这一步了。
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"设置颜色和大小" attributes:@{NSFontAttributeName:font, NSForegroundColorAttributeName:color}];
本文介绍如何使用Swift为UITextField自定义占位符的字体颜色和大小,通过NSAttributedString设置属性实现美观的界面显示。
148

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



