WCTextView继承自UITextView并添加了placeholder(占位文本)功能
WCTextView效果演示
pod 'WCTextView'
pod install
或 pod update
#import <WCTextView/WCTextView.h>
WCTextView *textView = [[WCTextView alloc] init];
textView.placeholder = @"占位文本";
......
/**
占位字符
*/
@property(nonatomic, copy) IBInspectable NSString *placeholder;
/**
占位字符的字体颜色
*/
@property (nonatomic, strong) IBInspectable UIColor *placeholderColor;
/**
占位字符(富文本)
*/
@property (nonatomic, strong) NSAttributedString *placeholderAttributedText NS_AVAILABLE_IOS(6_0);
/**
占位字符的字体大小
*/
@property(nonatomic, assign) UIFont *placeholderFont;
/**
占位字符最多能显示多少行
*/
@property(nonatomic, assign) NSUInteger placeholderNumberOfLines;
/**
占位字符的对齐方式
*/
@property(nonatomic, assign) NSTextAlignment placeholderTextAlignment;
/**
占位字符换行模式(lineBreakMode)
*/
@property(nonatomic, assign) NSLineBreakMode placeholderLineBreakMode;
WCTextView使用MIT许可证,详情见LICENSE文件