title: Dynamic TextField should accept numeric characters Only
body: <p>I have created the <code>textfield</code> dynamically, like 15 text field.By clicking next button i want to check whether the user has entered the numeric characters or not.Please help me to do this .I know ho to do this for <code>textfield</code> which is created in storyboard .But i dont know through programming for dynamic textfields.</p>
  
  <p>Here is my code ,</p>
  
  <pre><code> //Creating TextField
  
      UITextField *metaData_txt = [[UITextField alloc]init];
      metaData_txt.frame = CGRectMake(xPosOfTxt,yPosOfTxt , widthOfTxt, heightOfTxt);
      metaData_txt.layer.cornerRadius = 5;
      metaData_txt.layer.borderWidth =1.0;
      metaData_txt.layer.borderColor = [UIColor blackColor].CGColor;
      metaData_txt.tag = (txtTagBaseVaue +i);
         [self.metaData_txt setDelegate:self];       
            [self.sub_View addSubview:metaData_txt];
  </code></pre>
  
  <p>..checking numeric numeric characters on clickiing next button </p>
  
  <pre><code>-(IBAction)next:(id)sender {
      NSArray *subviews = [self.sub_View subviews];
  
      for (UIView *newView in subviews) {
          if([newView isKindOfClass:[UITextField class]])
          {
  
                NSInteger tag = newView.tag;
              int index = tag - 100;
  
  
              FieldData *fieldData = [self.metaDataArray objectAtIndex:index];
         if (textField.text.length == 0) {
  
                       [self.view makeToast:label duration:1.0 position:CSToastPositionCenter];
                      NSLog(@"enter characters");
  
                  }
  
  
                  else if (textField.text.length &gt; 0)
                  {
                 NSString *feildValue  = [self formatTypeToString:fieldData.fieldAttribute];
                      NSString *numeric = @"NUMERIC";
  
                      if (feildValue == numeric) {
  
  
                          [self textField:textField shouldChangeCharactersInRange:&lt;#(NSRange)#&gt; replacementString:&lt;#(nonnull NSString *)#&gt;];
  
  
                      }
  </code></pre>
  
  <p>i have written the <code>shouldchangechractersin</code> range method also :
  i dont what range and string i have to give , while calling the below method            </p>
  
  <pre><code>- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
     {
      if (!string.length)
      return YES;
  
  if (textField)
  {
      NSString *newString = [textField.text stringByReplacingCharactersInRange:range withString:string];
      NSString *expression = @"^([0-9]+)?(\\.([0-9]{1,2})?)?$";
      NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:expression
                                                                             options:NSRegularExpressionCaseInsensitive
                                                                               error:nil];
      NSUInteger numberOfMatches = [regex numberOfMatchesInString:newString
                                                          options:0
                                                            range:NSMakeRange(0, [newString length])];
      if (numberOfMatches == 0)
          return NO;
  }
  return YES;
  }
  </code></pre>
  
  <p>Please help me to do this.<br>
  Thanks in advance!!!    </p>