Hide keyboard in ipad
How can I hide my keyboard when I click on my UIImageView?
I am trying to use this soution but it does not work with UIImageView:
- (IBAction)backgroundTap:(id)sender
{
logLang.hidden=YES;
pasComp.hidden=YES;
[login resignFirstResponder];
[pass开发者_运维技巧word resignFirstResponder];
}
Make sure your image view user interaction
enabled in xib? if you are adding your imageView pro grammatically then
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
if ([touch view] == yourImageView) {
logLang.hidden=YES;
pasComp.hidden=YES;
[login resignFirstResponder];
[password resignFirstResponder];
}
}
use the UIResponder methods touchesBegan, touchesMoved, touchesEnded etc to detect the touch on the image view
精彩评论