开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜