| 测试已测试 | ✗ |
| Lang语言 | Obj-CObjective C |
| 许可证 | MIT |
| 发布最后发布 | 2014年12月 |
由 Andre Espeiorin 维护。
UITextView 替代品,允许开发者在不使用任何代码的情况下向 TextView 添加占位符行为
导入类
#import <ESPPlaceholderTextView/ESPPlaceholderTextView.h>
#import <ESPPlaceholderTextView/ESPPlaceholderControl.h>创建 ESPPlaceholderTextView 实例
self.textView = [[ESPPlaceholderTextView alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 200.0)];
self.textView.placeholder = @"Placeholder";
self.textView.placeholderColor = [UIColor lightGrayColor];创建 ESPPlaceholderControl 实例
ESPPlaceholderControl *control = [[ESPPlaceholderControl alloc] init];连接两个对象
control.owner = self.textView;
self.textView.delegate = control;如果您需要(始终如此)将 UITextViewDelegate 的方法委托给另一个对象,则可以将此对象分配给 ESPPlaceholderControl 目标。
control.targets = @[self];它们将没有干扰地工作