为了能够简单的使用这个属性,我重新自定义了一个UITextView。
用法非常简单:直接使用点语法设置placeholder字段即可,
除了这个属性外,它还可以自动调节高度,
需要调节高度时直接使用initWithWidth:maxHeight:方法即可
源码地址:http://git.oschina.net/larknan/LNTextView
- (void)viewDidLoad {
[super viewDidLoad];
LNTextView *textView = [[LNTextView alloc]initWithWidth:250 maxHeight:150];
// LNTextView *textView = [[LNTextView alloc]init];
textView.frame = CGRectMake(10, 50, 100, 100);
textView.placeholder = @"提示字段";
textView.lnDelegate = self;
[self.view addSubview:textView];
}