I made a Text Field with interface builder. How can I get its text to use somewhere else?
Is there something like:
string text = myTextField.Text;
If so, how can I name my text field?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
So the first thing you want to do is create a property in the .h file of the view controller files associated with your xib file like so:
Next in the .m file you need to synthesize it like so:
Within you implementation tag.
Now in interface builder control click where it says “File’s Owner” on the left side of the screen in Xcode 4.3 hold down and drag over the label and let go. Then in the popup select the name of the property you created. Now in the viewDidLoad method of your view controller you can get at your value like so: