我正在使用以下代码更改占位符文本的颜色,但是当我尝试添加NSFontAttribute时,我会遇到编译器错误"too many arguments to method call, expect 2 have 3"
UIColor *color = [UIColor blackColor];
_nameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Your Name" attributes:@{NSForegroundColorAttributeName: color},@{NSFontAttributeName:@"Roboto-Bold"}];
这样做很好:
UIColor *color = [UIColor blackColor];
_nameField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"Your Name" attributes:@{NSForegroundColorAttributeName: color}];