开发者

problem on UITouchs , after touching the out side of the textfield i.e in view key board should disappear

First time the below code works fine ,,, but after getting back to same view it not working

- (void)开发者_StackOverflow中文版touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [userNameField resignFirstResponder];
    [passwordField resignFirstResponder];
    [self.view resignFirstResponder];
}

this method is not calling after get back to same view , which i have return this code ... and my problem after touching out side of the textfield i.e on UIView the keyboard show resignFirstReponder


Try below code

- (IBAction)backgroundTap:(id)sender 
{ 
     [yourtextfield resignFirstResponder];
}

In XIB attach this method with TouchDown event of UIView.


Try with removing below from touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event.

[self.view resignFirstResponder];

Form Documentation :

Notifies the receiver that it has been asked to relinquish its status as first responder in its window.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜