1、只能输入数字
NSString *regex = @"\\d+";
NSPredicate *Pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];
BOOL isMatch = [Pred evaluateWithObject:numberTF.text];
if (!isMatch){
UIAlertController *reminderCtrl = [UIAlertController alertControllerWithTitle:@"提示" message:@"只能输入数字" preferredStyle:UIAlertControllerStyleAlert];
[reminderCtrl addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:reminderCtrl animated:YES completion:nil];
}else{
NSLog(@"成功...");
}