Skip to content

Instantly share code, notes, and snippets.

@gliubc
Created December 17, 2018 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gliubc/91fade43359a38797ca275efb25706a7 to your computer and use it in GitHub Desktop.
Save gliubc/91fade43359a38797ca275efb25706a7 to your computer and use it in GitHub Desktop.
if ([textField respondsToSelector:@selector(setAttributedPlaceholder:)]) {
UIColor *color = [UIColor blackColor];
textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholderText attributes:@{NSForegroundColorAttributeName: color}];
} else {
NSLog(@"Cannot set placeholder text's color, because deployment target is earlier than iOS 6.0");
// TODO: Add fall-back code to set placeholder color.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment