点击空白关闭键盘

2019-01-15 11:08:31 浏览数 (1)

//点击空白收回键盘

-(void)touchReturnPad{

self.view.userInteractionEnabled = YES;

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(fingerTapped:)];

    [self.view addGestureRecognizer:singleTap];

}

-(void)fingerTapped:(UITapGestureRecognizer *)gestureRecognizer

{

    [self.view endEditing:YES];

}

0 人点赞