Closed D-32 closed 9 years ago
@D-32 - Did you solve this problem in any way?
My work around is to remove line 112 - 113, the setupTextField() and setupTableView() calls inside the initialize() method (AutocompleteTextfield.swift). And made those two setup methods public. Then in my code I add the textfield as a subview and call these two methods after addSubview.
@D-32 , thanks for reporting this issue. Although your fix will work fine, this is not good practice since i created this library to reduce work like what you did. In my fix, i modified setupTableView()
to setupTableView(view:UIView?)
and used the willMoveToSuperview(newSuperview: UIView?)
to call initialize(superview:UIView?)
. This will make the tableview add itself right after the textfield has been added to its superview.
Hope this fix helps you.
Not sure if it's the same problem #2 has, but I thought I'll write this down in case you want to take a look or if somebody else runs into this. I'm manually adding the view, so I'm using the initWithFrame method which then internally calls initialize (and setupTableView). The problem is that inside setupTableView you're adding the table view to the field's superview. But I'm obviously adding the field to my super view after the init call. Probably when using Storyboards the superview is already ready at that point.
Thanks anyway for your work, it's looking great in my project :)