diff --git a/Classes/ChatConversationCreateView.h b/Classes/ChatConversationCreateView.h index f53860c34..297a24d52 100644 --- a/Classes/ChatConversationCreateView.h +++ b/Classes/ChatConversationCreateView.h @@ -10,7 +10,7 @@ #import "ChatConversationCreateTableView.h" #import "UICompositeView.h" -@interface ChatConversationCreateView : UIViewController +@interface ChatConversationCreateView : UIViewController @property(strong, nonatomic) IBOutlet ChatConversationCreateTableView *tableController; @property(weak, nonatomic) IBOutlet UIIconButton *backButton; diff --git a/Classes/ChatConversationCreateView.m b/Classes/ChatConversationCreateView.m index a5f074c80..618babd81 100644 --- a/Classes/ChatConversationCreateView.m +++ b/Classes/ChatConversationCreateView.m @@ -42,7 +42,7 @@ static UICompositeViewDescription *compositeDescription = nil; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissKeyboards)]; - + tap.delegate = self; [self.view addGestureRecognizer:tap]; } @@ -58,7 +58,19 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)dismissKeyboards { - [self.tableController.searchBar resignFirstResponder]; + if ([self.tableController.searchBar isFirstResponder]) { + [self.tableController.searchBar resignFirstResponder]; + } +} + +#pragma mark - GestureRecognizerDelegate + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch +{ + if (![self.tableController.searchBar isFirstResponder]) { + return NO; + } + return YES; } @end diff --git a/Classes/ContactDetailsView.m b/Classes/ContactDetailsView.m index b2482e04b..cd1cf3992 100644 --- a/Classes/ContactDetailsView.m +++ b/Classes/ContactDetailsView.m @@ -196,6 +196,16 @@ _avatarImage.hidden = TRUE; } } + + if (self.tableController.isEditing) { + _backButton.hidden = TRUE; + _cancelButton.hidden = FALSE; + } else { + if (!IPAD) { + _backButton.hidden = FALSE; + } + _cancelButton.hidden = TRUE; + } } - (void)viewWillDisappear:(BOOL)animated { @@ -463,4 +473,6 @@ static UICompositeViewDescription *compositeDescription = nil; [_avatarImage setImage:[FastAddressBook imageForContact:_contact thumbnail:NO] bordered:NO withRoundedRadius:YES]; } + + @end diff --git a/Classes/ContactsListView.h b/Classes/ContactsListView.h index c2df44da4..9a14b6d56 100644 --- a/Classes/ContactsListView.h +++ b/Classes/ContactsListView.h @@ -71,7 +71,7 @@ typedef enum _ContactSelectionMode { ContactSelectionModeNone, ContactSelectionM @end -@interface ContactsListView : UIViewController +@interface ContactsListView : UIViewController @property(strong, nonatomic) IBOutlet ContactsListTableView *tableController; @property(strong, nonatomic) IBOutlet UIView *topBar; diff --git a/Classes/ContactsListView.m b/Classes/ContactsListView.m index 0a737b3d7..6859c169d 100644 --- a/Classes/ContactsListView.m +++ b/Classes/ContactsListView.m @@ -114,6 +114,7 @@ static UICompositeViewDescription *compositeDescription = nil; initWithTarget:self action:@selector(dismissKeyboards)]; + [tap setDelegate:self]; [self.view addGestureRecognizer:tap]; } @@ -226,7 +227,9 @@ static UICompositeViewDescription *compositeDescription = nil; } - (void)dismissKeyboards { - [self.searchBar resignFirstResponder]; + if ([self.searchBar isFirstResponder]){ + [self.searchBar resignFirstResponder]; + } } #pragma mark - searchBar delegate @@ -254,4 +257,14 @@ static UICompositeViewDescription *compositeDescription = nil; [searchBar resignFirstResponder]; } +#pragma mark - GestureRecognizerDelegate + +- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch +{ + if (![self.searchBar isFirstResponder]) { + return NO; + } + return YES; +} + @end diff --git a/Classes/LinphoneUI/UIContactDetailsCell.m b/Classes/LinphoneUI/UIContactDetailsCell.m index a9263f053..7a43fd3e4 100644 --- a/Classes/LinphoneUI/UIContactDetailsCell.m +++ b/Classes/LinphoneUI/UIContactDetailsCell.m @@ -117,11 +117,4 @@ forRowAtIndexPath:indexPath]; } -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - UIView * txt = self.editTextfield; - if ([txt isKindOfClass:[UITextField class]] && [txt isFirstResponder]) { - [txt resignFirstResponder]; - } -} - @end