简介
支持placeholder的UITextView, 并且简化设置TextView内边距功能。
代码示例
KKPlaceholderTextView *testTF = [[KKPlaceholderTextView alloc] initWithFrame:CGRectMake(50, 100, 100, 50)];
testTF.placeholder = @"请输入描述内容";
NSDictionary * attributesDic = @{ NSFontAttributeName:[UIFont boldSystemFontOfSize:12],
NSForegroundColorAttributeName:[UIColor redColor]
};
testTF.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"请输入描述内容" attributes:attributesDic];
// 设置textView 内边距
testTF.padding = UIEdgeInsetsMake(10, 10, 10, 10);
[self.view addSubview:testTF];
Cocoapods
pod 'KKPlaceholderTextView'