这是第一种,添加属性
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
dict[NSForegroundColorAttributeName] = [UIColor redColor];
NSAttributedString *string = [[NSAttributedString alloc]initWithString:@"cdcdcdcdcd" attributes:dict];
UITextField *field = [[UITextField alloc]initWithFrame:CGRectMake(30,230,120, 33)];
field.attributedPlaceholder = string;
[self.view addSubview:field];
[field setValue:[UIColor greenColor] forKeyPath:@"_placeholderLabel.textColor"];
[field setValue:[UIFont boldSystemFontOfSize:16] forKeyPath:@"_placeholderLabel.font"];