I’m trying to code a simple UITextField and I have a simple question:
Im using this to ’empty’ the UITextField:
-(IBAction)editbegin{
campo1.text="";
}
The problem is: want to use this function in more than one TextField. So, how can I ‘grab’ the object, so I can get the ‘text’? Already tried ‘self.text’, but it returns the view.
Thanks.
Check out the UITextField documentation. It looks like you are trying to “reinvent” the wheel.
If all you want to do is clear the textfield once a user begins editing, there is a function for that.
When creating your text field, just set:
The same option is also available on Interface Builder if that’s what you are using.
Specific documentation link here http://developer.apple.com/library/ios/DOCUMENTATION/UIKit/Reference/UITextField_Class/Reference/UITextField.html#//apple_ref/occ/instp/UITextField/clearsOnBeginEditing