Developer
Developer

Reputation: 1019

How to hide the keyboard while using TableView in Iphone?

In my application I have textfield and while inserting any values in it it is displaying according values to the tableview as the no. of rows.

I want that when I scroll on the Tableview with having so many filled rows ,the keyboard must be hidden at the time of scrolling.

I have search on the net,but unable to find out the solution.

please give any solution with code snippet or valuable link or any solution.

Thanks, Mishal Shah

Upvotes: 3

Views: 2112

Answers (3)

NiKKi
NiKKi

Reputation: 3296

Just write this code where you want to hide the keyboard. With this code there is no need to do resignFirstResponder.

[self.view endEditing:YES];

Njoy.. :)

Upvotes: 1

Zoran Simic
Zoran Simic

Reputation: 10333

In your table controller, add this:

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    [myTextField resignFirstResponder];
}

Upvotes: 8

Alex Reynolds
Alex Reynolds

Reputation: 96937

Generally, [myTextField resignFirstResponder] puts the keyboard modal view away. Depending on how you have set up handling scrolling, this should be enough to answer your question.

Upvotes: 1

Related Questions