您的位置:首页 > 产品设计 > UI/UE

ios UITextView的placeholder属性实现

2015-11-06 09:25 309 查看
为了能够简单的使用这个属性,我重新自定义了一个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];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: