Wednesday, 15 September 2010

iphone - UITextField text value returns garbage -


When I dismiss the keyboard, then I'm trying to get the string value from the textfield. However, it seems that whenever I try to get the value, I get garbage (the trash attempt to print textField.text shows garbage).

(The control displays okay, and I can also enter text value in it).

Here is my code:

  - (BOOL) textFieldShouldReturn: (UITextField *) textField {NSInteger currenttag = textField.tag; NSLog (@ "% d", textField.tag); If (current tag == 0) {nslog (@ "% x% s", (unsigned integer textfold.txt, textfield.txt); User name = textField.text; } And if (currenttag == 1) {password = textField.text; } [TextField Resigns First Responder]; Yes come back }  

Field names and passwords are zero NSString * 's, but since I'll only catch on NSStrings organized by textField.text, it should be fine.

  NSLog (@ "text field text:% @", textField.text);  

No comments:

Post a Comment