How can I get the value of a text field from a tag in iPhone sdk?

If I have a text field tag, how can I select a text field value in iPhone sdk

+6
source share
4 answers

you should be fine with something like (assuming TextField is a self.view subhead):

NSString *text = [(UITextField *)[self.view viewWithTag:THE_TAG] text]; 
+17
source

NSString * text = [(UITextField *) [self.view viewWithTag: tag] text];

+5
source

Try below

 UITextField *textField = (UITextField*)[self.view viewWithTag:tag_Number]; NSString* textString=[textField text]; //Use textString further 
+4
source

Using:

 UITextField *textField = (UITextField*)[self.view viewWithTag:100]; NSLog(@"%@",textField.text); 

You need to replace 100 with your own tag.

+3
source

Source: https://habr.com/ru/post/921940/


All Articles