Iam developing one application.In that i use the textview.But when we click on textview,or completion of entering the text into textview,textview delegate methods are not fired.Ias writtent he textview.delegate=self also.But they are not firing.So pleas etell me how to solve this one
Asked
Active
Viewed 124 times
0
-
http://stackoverflow.com/search?q=dismiss+keyboard+iphone – pasine Jul 28 '11 at 08:35
2 Answers
0
The UITextViewDelegate
methods do not handle dismissal of the keyboard: you must do that yourself, by calling:
[textView resignFirstResponder];
This will then trigger the textViewShouldEndEditing:(UITextView *)textView
delegate method. What you need to do is call the resignFirstResponder
method in response to whatever actions you require - if this is tapping outside the text view you'll need to create a gesture recognizer / button / whatever to pick up that tap and call resignFirstResponder
.

lxt
- 31,146
- 5
- 78
- 83
0
You can also use Keyboard notifications like:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow)
name:UIKeyboardWillShowNotification object:nil];
and in -(void) keyboardWillShow {}
set [myTextField resignFirstResponder];
hope this helps.

elp
- 8,021
- 7
- 61
- 120