Skip to content

yusanlou/BNTextField-Limit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BNTextField-Limit

限制输入字数

Installation with CocoaPods

edit your podfile

pod 'BNTextField-Limit'

end

Usage

Creat Textfield

UITextField *testField = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, 100, 40)];

Set limit

[testField limitCondition:^BOOL(NSString *inputStr){
        return ![weakTextField.text isEqualToString:@"111"];
    } action:^{
        NSLog(@"limit action");
}];

Or

[testField limitNums:3 action:^{
	NSLog(@"num limit action");
}];

Set observe

[testField observeValueWithCondition:^BOOL(NSString *inputStr) {
        return weakTextField.text.length%2 == 1;
    } action:^{
        NSLog(@"vlaue is conformed");
}];

⚠️WARNNING

if you want to set the delegate , just ... set it before setting the limit.

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors