1. Recycle the keyboard that pops up under a TextField
1 -(BOOL) Textfieldshouldreturn: (Uitextfield *) textfield{23 [ TextField Resignfirstresponder]; 4 return YES; 5 6 }
2. Click the empty space to recycle the keyboard
1 -(void) Touchesbegan: (Nsset<uitouch *> *) touches withevent: (uievent *)event 2 3{ 4 5 [SELF.PHONENUMTF Resignfirstresponder]; 6 7 [Self.secrettf Resignfirstresponder]; 8 9 Ten }
3. Click the empty space to recycle the keyboard (add gestures)
1- (void) Viewdidload2 { 3 [Super Viewdidload]; 4UITapGestureRecognizer *tapgesturerecognizer =[[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (keyboardhide:)]; 5 //set to No to indicate that the current control is propagated to other controls when it responds, by default yes. 6Tapgesturerecognizer.cancelstouchesinview =NO; 7 //Add a touch event to the current view8 [Self.view Addgesturerecognizer:tapgesturerecognizer]; 9 } Ten One-(void) Keyboardhide: (uitapgesturerecognizer*) tap{ A [textfiled Resignfirstresponder]; -}
iOS Recycle keyboard