//---驗證手機號的UIBtutton--
self.submitBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
self.submitBtn.frame = CGRectMake(0, self.undoView.frame.origin.y+self.undoView.frame.size.height, self.view.frame.size.width, 35);
self.submitBtn.backgroundColor = [UIColor colorWithHexString:@"47a5d6"];
//self.submitBtn.alpha = 0.5;
[self.submitBtn setTitle:@"發送" forState:(UIControlStateNormal)];
[self.submitBtn addTarget:self action:@selector(didBtnAction) forControlEvents:(ValidationEmailFormat)];
//郵箱地址
self.emailFT = [[UITextField alloc] initWithFrame:CGRectMake(30, lineView.frame.origin.y+lineView.frame.size.height + 15, self.view.frame.size.width-60, 40)];
self.emailFT.backgroundColor = [UIColor colorWithHexString:@"f8f8f8"];
self.emailFT.placeholder = @"您的手機號!";
self.emailFT.font = [UIFont systemFontOfSize:17.0];
self.emailFT.clearsOnBeginEditing = YES;
self.emailFT.textAlignment = NSTextAlignmentCenter;
[self.view addSubview:self.emailFT];
//[Dubai]驗證手機號是否正確
- (void)ValidationEmailFormat
{
NSString *mobileRegex = @"^((13[0-9])|(147)|(170)|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
NSPredicate *mobileTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",mobileRegex];
BOOL n = [mobileTest evaluateWithObject:self.emailFT.text];
if (n == NO) {
[AlertVC showWithMessage:@"手機號格式不正確!"];
self.navigationItem.rightBarButtonItem.enabled = YES;
[self removeLoadingView];
[self.timerTT invalidate];
}else{
[self.timerTT fire];
//[self removeLoadingView];
[self closeVC];
self.navigationItem.rightBarButtonItem.enabled = YES;
}
}