1.判断输入框的内容是否是数字
-(BOOL)isNumText:(NSString *)str{ NSString * regex = @"^[0-9]*$"; NSPredicate * pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex]; BOOL isMatch = [pred evaluateWithObject:str]; if (isMatch) { return YES; }else{ return NO; } }