forked from mirrors/linphone-iphone
Fix previsous commit: do not disable views touch when dismissing keyboards
This commit is contained in:
parent
6e38f85d68
commit
0d03b378d5
6 changed files with 42 additions and 12 deletions
|
|
@ -10,7 +10,7 @@
|
|||
#import "ChatConversationCreateTableView.h"
|
||||
#import "UICompositeView.h"
|
||||
|
||||
@interface ChatConversationCreateView : UIViewController <UICompositeViewDelegate>
|
||||
@interface ChatConversationCreateView : UIViewController <UICompositeViewDelegate, UIGestureRecognizerDelegate>
|
||||
|
||||
@property(strong, nonatomic) IBOutlet ChatConversationCreateTableView *tableController;
|
||||
@property(weak, nonatomic) IBOutlet UIIconButton *backButton;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ typedef enum _ContactSelectionMode { ContactSelectionModeNone, ContactSelectionM
|
|||
|
||||
@end
|
||||
|
||||
@interface ContactsListView : UIViewController <UICompositeViewDelegate, UISearchBarDelegate>
|
||||
@interface ContactsListView : UIViewController <UICompositeViewDelegate, UISearchBarDelegate, UIGestureRecognizerDelegate>
|
||||
|
||||
@property(strong, nonatomic) IBOutlet ContactsListTableView *tableController;
|
||||
@property(strong, nonatomic) IBOutlet UIView *topBar;
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue