I have a UITableView with CustomCells which contain a TextField. Look at the pictures which i have uploaded.
Picture1 Picture2
I want that if i start to scroll the keyboard should hide.
I tried it with
- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
NSLog(@"Got called");
ProductTableCell *cell;
[cell.mengeTextField resignFirstResponder];
}
Console-Log:
2012-04-24 12:57:48.924 Book-App[21029:15803] Got called
2012-04-24 12:57:50.535 Book-App[21029:15803] Got called
2012-04-24 12:57:51.681 Book-App[21029:15803] Got called
But this is not working for me.
Is there a other solution?
Your problem is what Arcank said, cell is not defined.
Now if you cannot access the cell, there is a way to cheat. Simply put something else a first responder, then resign it right away.
This would take care of your problem. If scrollView cannot become first responder just use other things that can. (improvise).
Edit: Just read you and Aalok Parikh comments, this is pretty much what he is trying to say.