Skip to content

Instantly share code, notes, and snippets.

@wuchuwuyou
Created November 3, 2017 07:59
Show Gist options
  • Save wuchuwuyou/aff2ada2041cd3adf7f5b5c30430f683 to your computer and use it in GitHub Desktop.
Save wuchuwuyou/aff2ada2041cd3adf7f5b5c30430f683 to your computer and use it in GitHub Desktop.
UITextView placeHolder
UILabel *placeHolderLabel = [[UILabel alloc] init];
placeHolderLabel.text = LDLocalizedString(@"xxxxxxxxx");
placeHolderLabel.numberOfLines = 0;
placeHolderLabel.textColor = [UIColor lightGrayColor];
[placeHolderLabel sizeToFit];
[self.userTextView addSubview:placeHolderLabel];
// same font
placeHolderLabel.font = self.userTextView.font;
[self.userTextView setValue:placeHolderLabel forKey:@"_placeholderLabel"];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment