tags:

views:

17

answers:

1

Hi,

I have a textfield to type the username, how will i get back the data to perform some action from the UITextField?

A: 

UITextField store data as NSString in text property:

@property(nonatomic, copy) NSString *text;

e.g:

NSLog(@"my text: %@", muTextField.text);

if you want to handle text changes while user edits text use delegate method:

 -(BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
Vladimir
Or if you just care about the final value (and not each change as the user makes it), you can use the delegate method: - (void)textFieldDidEndEditing:(UITextField *)textField
David Gelhar