UITextView vs UITextField
UITextView and UITextField sound similar but are actually pretty different. Once difference that has been really bothering me lately is an issue with UIReturnKeyDefault and UIReturnKeyDone. For those that don't know what this means...When you select a UITextView or UITextField for input the keyboard automatically pops up to allow the user to enter text. The problem is how do you hide the keyboard once typing is done. UITextField's have the ability to hide the keyboard using the keyboard "Done" button. UITextView's can't be closed with the "Done" button even though it supports displaying it with setting the objects returnKeyType. What is the point of displaying the "Done" button when there is no way to hide the keyboard when it's clicked.
You might ask: "Why not just use the UITextField, and not even bother with the UITextView?". Because the UITextField only allows text input on one line. I'd like the ability to have a multiline UITextField. That would actually solve the problem.
I'm no expert in UIKit, so if someone knows a better way to have a multiline text field with a keyboard done button that works post a comment.


4 Comments:
I've been having trouble with UIText field, actually, and was wondering if anyone can tell me how to make the keyboards disappear in my situation: I am using two text fields in my interface, and have been able to make one keyboard disappear after done is pressed but can't do the same for the second. This is what I have in my code (But like I said it only works for one of the keyboards for one of the text fields which is driving me crazy):
- (BOOL)textFieldShouldReturn:(UITextField *)thetextField {
[thetextField resignFirstResponder];
return YES;
}
I would check to make sure your other UITextField's delegate variable is set to "self". Post your code in the forums and I'll take a look.
Wow, thanks.
I want to handle the 'value change' event of a uitextfield. Which method do I need to implement in the textfield's delegate?
I am using a textfield in a custom ViewController which implements UITextFieldDelegate protocol.
Post a Comment
<< Home