SearchTextField icon indicating copy to clipboard operation
SearchTextField copied to clipboard

Reset filterStrings to a textField will cause tableView showed

Open hydrated opened this issue 5 years ago • 6 comments

Reproduce steps are

  1. Write a SearchTextField, set some filterStrings
  2. Interacting with it
  3. Programmatically set some filterStrings again.

And then the SearchTextField will show the suggestion tableView again. Even the SearchTextField is not in interacting state (resignTheFirstResponse). That's quite a problem for dynamic filterStrings situation.

hydrated avatar Nov 15 '18 09:11 hydrated

I change the visibility code to the

tableView.isHidden = !isFirstResponder || (filteredResults.count == 0)
shadowView?.isHidden = !isFirstResponder || (filteredResults.count == 0)

To avoid it for now.

hydrated avatar Nov 15 '18 09:11 hydrated

I face a smiliar issue.

To prevent duplicated values between several fields, I update the filterStrings accordingly for each fields. But when I do that, there is an odd display of tableview.

vcGF avatar Nov 19 '18 05:11 vcGF

I am facing the same issue. i am using textField in table cell and on reload table view all cells showing filtered results on all fields. Any solutions? img_d119a78da3b2-1

kaleemasadmughal avatar Dec 10 '18 13:12 kaleemasadmughal

i did this workaround self.textfieldname.filterStrings(list) self.textfieldname.becomeFirstResponder() self.textfieldname.resignFirstResponder()

bhushanrocks412 avatar Nov 11 '19 09:11 bhushanrocks412

Hi,

I have the same issue here. The workaround above didn't woked for me. When I update the content of the suggestion list, the filtered results appear (without focussing the SearchTextField)

Can someone help?

Thanks.

adrig2i avatar Nov 29 '19 16:11 adrig2i

Simply calling searchTextField.textFieldDidEndEditing() after setting filterItems (or filterStrings) worked for me. e.g

self.txtInput.filterItems(self.recentCommands.map { SearchTextFieldItem(title: $0) })
self.txtInput.textFieldDidEndEditing()

uynguyen avatar Jun 16 '21 12:06 uynguyen