Latest | 0.0.2 |
---|---|
Homepage | https://github.com/ONECATYU/WSInputLimit |
License | MIT |
Platforms | ios 8.0, requires ARC |
Frameworks | UIKit, Foundation |
Authors |
UITextView *textView = nil;
/// 是否禁用限制
textView.limit.disable = YES;
/// 禁用emoji输入
textView.limit.disableEmoji = YES;
/// 允许最大输入100个字符(length长度大于1的,按照1个字符计算)
textView.limit.maxCharacterNumber = 100;
/// 仅输入数字
textView.limit.onlyNumbers = YES;
/// 仅输入中文
textView.limit.onlyChinese = YES;
/// 仅输入英文字母
textView.limit.onlyLetter = YES;
/// 控制输入小数样式
textView.limit.decimaStyle = YES;
/// 控制小数位数
textView.limit.decimalPlace = 2;
/// 过滤输入中的数字(即数字不能输入)
textView.limit.filterPattern = @"[0-9]+";
/// 只允许输入数字
textView.limit.allowPattern = @"[0-9]+";
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textViewTextDidChange:) name:UITextViewTextDidChangeNotification object:textView];
- (void)textViewTextDidChange:(NSNotification *)notifi {
NSLog(@"当前输入: %d, 还可以输入: %d", textView.limit.currentCharNumber, textView.limit.canEnterCharNumber);
}
Latest podspec
{ "name": "WSInputLimit", "version": "0.0.2", "summary": "UITextView/UITextField Input Limit", "description": "* u652fu6301u7981u6b62emojiu8f93u5165n* u652fu6301u6700u5927u53efu8f93u5165u5b57u7b26u6570u91cfu9650u5236n* u652fu6301u9650u5236u4ec5u8f93u5165u6570u5b57n* u652fu6301u9650u5236u4ec5u8f93u5165u4e2du6587n* u652fu6301u9650u5236u4ec5u8f93u5165u82f1u6587u5b57u6bcdn* u652fu6301u5c0fu6570u6837u5f0fu8f93u5165u9650u5236n* u652fu6301u5c0fu6570u70b9u4f4du6570u9650u5236n* u652fu6301u81eau5b9au4e49u6b63u5219u5f0fu65b9u5f0fu8f93u5165", "homepage": "https://github.com/ONECATYU/WSInputLimit", "license": { "type": "MIT", "file": "LICENSE" }, "authors": { "ONECATYU": "[email protected]" }, "platforms": { "ios": "8.0" }, "source": { "git": "https://github.com/ONECATYU/WSInputLimit.git", "tag": "0.0.2" }, "source_files": [ "WSInputLimit", "WSInputLimit/**/*.{h,m}" ], "frameworks": [ "UIKit", "Foundation" ], "requires_arc": true }
Fri, 25 Jan 2019 11:49:05 +0000