- (void)viewDidLoad { [super viewDidLoad]; [self addTapForView]; } - (void)addTapForView { UITapGestureRecognizer *tapGestureRecognizer =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(backupgroupTap:)]; tapGestureRecognizer.numberOfTapsRequired =1; [self.view addGestureRecognizer:tapGestureRecognizer]; [tapGestureRecognizer setCancelsTouchesInView:NO]; } -(void)backupgroupTap:(id)sender{ [self.view endEditing:YES]; }
时间: 2024-10-16 03:00:26