Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C, How can i get the value of a UITextField?

How can i get the value of a UITextField? Some sample code to attach it to an NSString would be fab!

like image 343
tarnfeld Avatar asked Jan 01 '10 00:01

tarnfeld


1 Answers

The UITextField has to be connected to your file through Interface Builder, and declared as an IBOutlet in your header file:

IBOutlet UITextField *textField;

Then you'd access it in your methods as:

NSString *enteredText = [textField text]; // Or textField.text
like image 107
Jason B Avatar answered Sep 20 '22 17:09

Jason B