Remove notifications
-(void) Dealloc {
[[Nsnotificationcenter Defaultcenter]removeobserver:nil];
}
-(void) Viewdidload {
[Super Viewdidload];
Do any additional setup after loading the view from its nib.
Add tap gestures
Self.tapgesture = [[UITapGestureRecognizer alloc] initwithtarget:self action: @selector (Hideskeyboard)];
self.tapGesture.enabled = no;//First gesture set to NO
[Self.view AddGestureRecognizer:self.tapGesture];
Keyboard display I used the notification combination gesture.
Registration Notice,
[[Nsnotificationcenter Defaultcenter] Addobserver:self
Selector: @selector (keyboardwillshow)
Name:uikeyboardwillshownotification
Object:nil];
}
Hide keyboard
-(void) hideskeyboard{
[Self.view Endediting:yes];
self.tapGesture.enabled = NO;
}
The way to complete the notification is to set the gesture to Yes
-(void) Keyboardwillshow {
self.tapGesture.enabled = YES;
}
text box input and keyboard hiding