Dismiss Keyboards when tapping out of them

This commit is contained in:
REIS Benjamin 2016-10-21 12:29:45 +02:00
parent e6c1496d3f
commit 6e38f85d68
3 changed files with 29 additions and 0 deletions

View file

@ -39,6 +39,11 @@ static UICompositeViewDescription *compositeDescription = nil;
if (IPAD) {
_backButton.hidden = YES;
}
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(dismissKeyboards)];
[self.view addGestureRecognizer:tap];
}
- (void)viewWillAppear:(BOOL)animated {
@ -51,4 +56,9 @@ static UICompositeViewDescription *compositeDescription = nil;
- (IBAction)onBackClick:(id)sender {
[PhoneMainView.instance popCurrentView];
}
- (void)dismissKeyboards {
[self.tableController.searchBar resignFirstResponder];
}
@end

View file

@ -110,6 +110,11 @@ static UICompositeViewDescription *compositeDescription = nil;
/*if ([tableController totalNumberOfItems] == 0) {
[self changeView:ContactsAll];
}*/
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(dismissKeyboards)];
[self.view addGestureRecognizer:tap];
}
- (void)viewWillAppear:(BOOL)animated {
@ -220,6 +225,10 @@ static UICompositeViewDescription *compositeDescription = nil;
[searchBar resignFirstResponder];
}
- (void)dismissKeyboards {
[self.searchBar resignFirstResponder];
}
#pragma mark - searchBar delegate
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {

View file

@ -131,6 +131,12 @@ static UICompositeViewDescription *compositeDescription = nil;
UILongPressGestureRecognizer *oneLongGesture =
[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(onOneLongClick:)];
[_oneButton addGestureRecognizer:oneLongGesture];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(dismissKeyboards)];
[self.view addGestureRecognizer:tap];
if (IPAD) {
if (LinphoneManager.instance.frontCamId != nil) {
@ -422,4 +428,8 @@ static UICompositeViewDescription *compositeDescription = nil;
}
linphone_core_stop_dtmf(LC);
}
- (void)dismissKeyboards {
[self.addressField resignFirstResponder];
}
@end