给TextView添加PlaceHolder

2017-12-20  本文已影响6人  白与红与黑

UILabel *placeHolderLabel = [[UILabel alloc] init];

placeHolderLabel.text = @"请填写详细的街道门牌信息";

placeHolderLabel.numberOfLines = 0;

placeHolderLabel.textColor = [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1/1.0];

[placeHolderLabel sizeToFit];

placeHolderLabel.font = [UIFont fontWithName:@"PingFangSC-Light" size:14];

[self.textView setValue:placeHolderLabel forKey:@"_placeholderLabel"];

[self.textView addSubview:placeHolderLabel];

上一篇下一篇

猜你喜欢

热点阅读