IOS Mobile Phone Number Format Verification
// --- Verify the UIBtutton of the mobile phone number --
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: @ "send" forState :( UIControlStateNormal)];
[Self. submitBtn addTarget: self action: @ selector (didBtnAction) forControlEvents :( ValidationEmailFormat)];
// Email address
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 = @ "your mobile phone number! ";
Self. emailFT. font = [UIFont systemFontOfSize: 17.0];
Self. emailFT. clearsOnBeginEditing = YES;
Self. emailFT. textAlignment = NSTextAlignmentCenter;
[Self. view addSubview: self. emailFT];
// [Dubai] Verify that the mobile phone number is correct
-(Void) ValidationEmailFormat
{
NSString * assumeregex = @ "^ (13 [0-9]) | (147) | (170) | (15 [^ 4, \ D]) | (18 [0, 5-9]) \ d {8} $ ";
NSPredicate * mobileTest = [NSPredicate predicateWithFormat: @ "self matches % @", assumeregex];
BOOL n = [mobileTest evaluateWithObject: self. emailFT. text];
If (n = NO ){
[AlertVC showWithMessage: @ "Incorrect mobile phone number format! "];
Self. navigationItem. rightBarButtonItem. enabled = YES;
[Self removeLoadingView];
[Self. timerTT invalidate];
} Else {
[Self. timerTT fire];
// [Self removeLoadingView];
[Self closeVC];
Self. navigationItem. rightBarButtonItem. enabled = YES;
}
}