[Code Note] UITextField sets the placeholder color and the placeholder color code.
I ,.
2. Engineering Drawing.
3. Code.
RootViewController. h
#import <UIKit/UIKit.h>@interface RootViewController : UIViewController<UITextFieldDelegate>@end
RootViewController. m
# Import "RootViewController. h "@ interface RootViewController () @ end @ implementation RootViewController-(id) initWithNibName :( NSString *) bundle :( NSBundle *) handle {self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil]; if (self) {// Custom initialization} return self;}-(void) viewDidLoad {[super viewDidLoad]; // Do any additional setup after loading the view. UITextField * textField = [[UITextField alloc] initWithFrame: CGRectMake (50,100,200, 50)]; // UITextField sets the placeholder color UIColor * color = [UIColor redColor]; textField. attributedPlaceholder = [[NSAttributedString alloc] initWithString: @ "password" attributes: @ {NSForegroundColorAttributeName: color}]; textField. delegate = self; [self. view addSubview: textField];}