cs1.6
cs1.6

Reputation: 159

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];
[password resignFirstResponder];


}

Upvotes: 0

Views: 300

Answers (1)

Praveen-K
Praveen-K

Reputation: 3401

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

Upvotes: 1

Related Questions