ios 同时判断多个UITextFiled是否为空的方法。

先建立一個NSMutableArray,把每個Label都加進去

例:

NSMutableArray *myArrays = [[NSMutableArray alloc]init];

[myArrays addObject:yourField];

檢查:

for (UITextField *textField in myArrays)

{

    if ([textField.text legth] == 0)//判斷label的字串數是否為0

    {

        //如果沒有字串跳出警示訊息,例如UIAlertView

    }

}

猜你喜欢

转载自zhangmingwei.iteye.com/blog/2095177
今日推荐