1、定义一个事件:
1 | -(IBAction)limitLength:(UITextField *)sender |
2、对UITextField控件添加监听事件:
1 | //UIControlEventEditingChanged |
1 | [self.txtName addTarget:self action:@selector(limitLength:) forControlEvents:UIControlEventEditingChanged]; |
1、定义一个事件:
1 | -(IBAction)limitLength:(UITextField *)sender |
2、对UITextField控件添加监听事件:
1 | //UIControlEventEditingChanged |
1 | [self.txtName addTarget:self action:@selector(limitLength:) forControlEvents:UIControlEventEditingChanged]; |