hello everyone,
i want to read the string from a UItextField object but it doesn’t work. everybody an answer?
hello everyone,
i want to read the string from a UItextField object but it doesn’t work. everybody an answer?
Hi,
What have you tried and exactly what’s not working? Maybe post some code and/or error messages…
Are you using ofxNSStringToString to convert?
this is the code… I have changed different things, but it doesn’t work.
//----------------------------------------------------------------
-(IBAction)TEXT:(id)sender{
UITextField * text = sender;
// test to read the text input
printf("TEXT value is - %i\n", [text value]);
// test to read the text input
cout<<"TEXT value is "<<text<<endl;
// TEXTstring is declared in testApp.h
myApp->TEXTstring = text;
}
i need an example!
thanke, paul.
Hi, have you tried using the “text” property of the UiTextField and not the “value” property.
Edit: here you go… here’s an example of the way to do it:
- (IBAction)textFieldDoneEditing:(id)sender {
UITextField *userTextField = (UITextField *)sender;
NSString *userText = [[NSString alloc] initWithFormat:userTextField.text];
textLabel.text = userText;
[userText release];
[sender resignFirstResponder];
}
thank you for the example.