Friday, July 19, 2013

Change UITextField placeholder text color -- iPhone

The introduction of attributed strings in UIViews in iOS 6, it's possible to assign a color to the placeholder text like this:
UIColor *color = [UIColor blackColor];
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholderText attributes:@{NSForegroundColorAttributeName: color}];

No comments:

Post a Comment