Skip to content

一个UITextField类的category, 可以一行代码实现对UITextField字数的限制。

Notifications You must be signed in to change notification settings

MrQQQQQQQQQQ/Category4LimitedUITextField

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Category4LimitedUITextField

一个UITextField类的category, 可以一行代码实现对UITextField字数的限制。 使用方法: 1 将 UITextField+MQCustom.h和UITextField+MQCustom.m 文件拖入你的工程 并 #import "UITextField+MQCustom.h" 2.example:

     UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(0, 100, CGRectGetMaxX(self.view.frame), 30)];
      textField.maxLength = 10; //限制长度
     textField.valueChangedBlock = ^(NSString* content){ // 输入内容改变时的监听
       NSLog(@"textField content did changed to :%@",content);        
     };
   [self.view addSubview:textField];

About

一个UITextField类的category, 可以一行代码实现对UITextField字数的限制。

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published