How can I read UITextField
value in an IBAction
? I\'m creating UITextField
programmatically. So I can\'t set @property
an
if your doneEditing:
looks like this doneEditing:(id)sender
then you can say:
UITextField *field = (UITextField *)sender;
NSString *myText = field.text;
EDIT:
To access a UITextField without setting as an instance variable you need to tag it when you create it:
[textField setTag:1];
then whenever you want to access it you can get it from its parent view by the tag:
UITextField *myTextField = [scroller viewWithTag:1];
NSString *myString = myTextField.text;
in your case, set the tag to i+1
for example to have all the textfield with unique tags.