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.
精彩评论