#pragma mark UITextFieldDelegate
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
// 判斷輸入的是否為數字 (只能輸入數字)
NSString *validRegEx =@"^[0-9]*$";
NSPredicate *regExPredicate =[NSPredicate predicateWithFormat:@"SELF MATCHES %@", validRegEx];
BOOL myStringMatchesRegEx = [regExPredicate evaluateWithObject:string];
if (myStringMatchesRegEx)
return YES;
else
return NO;
}