How to hide keyboard for UITextView with return key?-IPhone:
The following three simple steps is used to dismiss the keyboard for UITextView while clicking return key.
The following three simple steps is used to dismiss the keyboard for UITextView while clicking return key.
Step:1
Subscribe to the UITextFieldDelegate Protocol in your View/ViewController's header file like:
Step:2
Setyour view/viewcontroller to be the UITextField's delegate after you init the textfield in the .m:
Then in your .m file you need to implement the following UITextFieldDelegate protocol method:
That's all. If this post was useful to you please send your valuable commentsSubscribe to the UITextFieldDelegate Protocol in your View/ViewController's header file like:
@interface YourViewController : UIViewController <UITextFieldDelegate>
Step:2
Setyour view/viewcontroller to be the UITextField's delegate after you init the textfield in the .m:
yourTextField.delegate = self;
Sterp:3Then in your .m file you need to implement the following UITextFieldDelegate protocol method:
- (BOOL)textFieldShouldReturn:(UITextField *)theTextField
{
[theTextField resignFirstResponder];
return YES;
}
0 comments:
Post a Comment
Share your thoughts here...