Objective-C, How can i get the value of a UITextField?
How can i get the value of 开发者_如何学Ca UITextField
?
Some sample code to attach it to an NSString
would be fab!
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
NSString *tf_text = [ yourTextField text ];
If in doubt always look at the documentation it'll give you the answer faster than asking on here!
In this case: UITextField and for future reference: iPhone class documentation
精彩评论