From a6f65bc7ea61e25b8833e66a5ffa8599658121b2 Mon Sep 17 00:00:00 2001 From: Ken Leland III Date: Thu, 12 Mar 2015 10:34:24 -0400 Subject: [PATCH 1/3] moved selectTextView From: removeContatByKey - this method is called when you call removeContact:id, which is called usually from a tap on a tableviewcell. this should not cause the keyboard to display To: removeContactView - this method is only called internally when contacts are removed via the backspace button. this is a situation where you want the keyboard to stay up after the deletion also note there was a second bug fix in this commit, namely if you deleted the selectedContactView, it would leave self.selectedContactView selected, which is used as a condition in other places and then causes a mis-keyboard fire. --- Classes/THContactPickerView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/THContactPickerView.m b/Classes/THContactPickerView.m index bc52f21..77862ae 100755 --- a/Classes/THContactPickerView.m +++ b/Classes/THContactPickerView.m @@ -283,6 +283,11 @@ - (void)removeContactView:(THContactView *)contactView { } [self removeContactByKey:contact]; + [self selectTextView]; + + if (self.selectedContactView == contactView) { + self.selectedContactView = nil; + } } - (void)removeContactByKey:(id)contactKey { @@ -295,7 +300,6 @@ - (void)removeContactByKey:(id)contactKey { [self.contactKeys removeObject:contactKey]; self.textField.text = @""; - [self selectTextView]; // update layout [self layoutContactViews]; From e71e8bc6fe9d7cfce114aaf8104f0e0ba3961919 Mon Sep 17 00:00:00 2001 From: Ken Leland III Date: Thu, 12 Mar 2015 11:10:16 -0400 Subject: [PATCH 2/3] propograte unSelecting a contactView bug fix: if a contact view is unselected, it never clears the ContactPickerView#selectedContactView property. this fixes that. --- Classes/THContactPickerView.m | 4 ++++ Classes/THContactView.m | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Classes/THContactPickerView.m b/Classes/THContactPickerView.m index 77862ae..6f4bc41 100755 --- a/Classes/THContactPickerView.m +++ b/Classes/THContactPickerView.m @@ -510,6 +510,10 @@ - (void)contactViewWasSelected:(THContactView *)contactView { } - (void)contactViewWasUnSelected:(THContactView *)contactView { + if (self.selectedContactView == contactView){ + self.selectedContactView = nil; + } + [self selectTextView]; // transfer the text fromt he textField within the ContactView if there was any // ***This is important if the user starts to type when a contact view is selected diff --git a/Classes/THContactView.m b/Classes/THContactView.m index a928fab..d565545 100755 --- a/Classes/THContactView.m +++ b/Classes/THContactView.m @@ -188,6 +188,10 @@ - (void)select { } - (void)unSelect { + if ([self.delegate respondsToSelector:@selector(contactViewWasUnSelected:)]){ + [self.delegate contactViewWasUnSelected:self]; + } + CALayer *viewLayer = [self layer]; viewLayer.borderColor = self.style.borderColor.CGColor; From 0737f29adc7ad02796c5a2bac99b96578a0df5a5 Mon Sep 17 00:00:00 2001 From: Ken Leland III Date: Thu, 12 Mar 2015 11:26:57 -0400 Subject: [PATCH 3/3] missed one! --- Classes/THContactPickerView.m | 1 + 1 file changed, 1 insertion(+) diff --git a/Classes/THContactPickerView.m b/Classes/THContactPickerView.m index 6f4bc41..e859e5a 100755 --- a/Classes/THContactPickerView.m +++ b/Classes/THContactPickerView.m @@ -173,6 +173,7 @@ - (void)addContact:(id)contact withName:(NSString *)name { if (self.selectedContactView){ // if there is a selected contact, deselect it [self.selectedContactView unSelect]; + self.selectedContactView = nil; [self selectTextView]; }