码迷,mamicode.com
首页 > 其他好文 > 详细

监测多个textFiled.text的长度同时不小于0

时间:2015-11-08 20:48:44      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

#pragma mark - 显示超过11位不让输入

- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{

    

    NSString * str1 = _nameTextFiled.text;

    NSString * str2 = _numberTextFiled.text;

    NSString * str3 = _passWordTextFiled1.text;

    NSString * str4 = _passWordTextFiled2.text;

    

    if (textField == _nameTextFiled) {

        str1 = [_nameTextFiled.text stringByAppendingString:string];

    }else if (textField == _numberTextFiled){

        str2 = [_numberTextFiled.text stringByAppendingString:string];

    }else if (textField == _passWordTextFiled1){

        str3 = [_passWordTextFiled1.text stringByAppendingString:string];

    }else if (textField == _passWordTextFiled2){

        str4 = [_passWordTextFiled2.text stringByAppendingString:string];

    }

    //保存按钮显示与隐藏

    if (str1.length*str2.length*str3.length*str4.length!=0) {

        

        [self SaveButtonEnbale];

    }else{

        [self SaveButtonNotEnbale];

    }

    

        return YES;

}

监测多个textFiled.text的长度同时不小于0

标签:

原文地址:http://www.cnblogs.com/block123/p/4948058.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!