- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
UITapGestureRecognizer *tapRecognizer = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleBackgroundTap:)];
tapRecognizer.cancelsTouchesInView = NO;
[self.view addGestureRecognizer:tapRecognizer];
}
- (void) handleBackgroundTap:(UITapGestureRecognizer*)sender
{
[nameField resignFirstResponder];
[SexField resignFirstResponder];
}
iOS——点击背景取消键盘的方法
最新推荐文章于 2021-12-19 14:47:01 发布