Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XCode 8/Swift 3 Problems #42

Open
cnpetrich opened this issue Sep 23, 2016 · 7 comments
Open

XCode 8/Swift 3 Problems #42

cnpetrich opened this issue Sep 23, 2016 · 7 comments

Comments

@cnpetrich
Copy link

The TableView never appears. I have debugged showing events firing correctly, but I never see any results appear after calling .autoCompleteStrings. Has anyone had any success after upgrading to xCode 8?

@mnbayan
Copy link
Owner

mnbayan commented Sep 25, 2016

Hi @cnpetrich , Thanks for reporting this issue. I am currently working for the updates for XCode 8. I will investigate this issue and if confirmed, will provide the fix.

@RahulM1987
Copy link

RahulM1987 commented Oct 4, 2016

Hi @mnbayan , I am trying to get the tableview in Xcode 8 for Autocomplete textfield but it does not shows me when I set the storyboard for 6s or SE its not showing me subview which is tableview, however if is undone the changes and don't keep the storyboard specific it works.

Have you got the solution over it?

@cnpetrich
Copy link
Author

Hi @mnbayan, any update on this? Still no luck from my side.

@cnpetrich
Copy link
Author

cnpetrich commented Oct 7, 2016

After way too many hours spent troubleshooting and googling, it looks like it's a problem with how subviews are initialized in XCode 8. See here.

You can fix this by modifying setupAutocompleteTable function by adding the two lines below at the beginning of the function:

public func setupAutocompleteTable(_ view:UIView){
self.superview?.layoutIfNeeded()
self.layoutIfNeeded()
...

p.s. I hate XCode 8.

@cnpetrich cnpetrich reopened this Oct 11, 2016
@ghost
Copy link

ghost commented Oct 12, 2016

Hi @cnpetrich. I modify setupAutocompleteTable function as you suggested, and yes - view is displayed, but in my case it appears in wrong place. Strictly speaking it appears above TextField instead of under.

In your project everything is ok?

@cnpetrich
Copy link
Author

cnpetrich commented Oct 12, 2016

Yes, there were some additional changes I had to make to the function. Here is all of the modified code below. Please try and let me know if it works for you as well:

public func setupAutocompleteTable(_ view:UIView){
self.superview?.layoutIfNeeded()
self.layoutIfNeeded()
let screenSize = UIScreen.main.bounds.size
let tableView = UITableView(frame: CGRect(x: self.frame.origin.x, y: self.frame.origin.y + self.frame.height, width: screenSize.width - (self.frame.origin.x * 2), height: 30.0))
tableView.dataSource = self
tableView.delegate = self
tableView.rowHeight = autoCompleteCellHeight
tableView.isHidden = hidesWhenEmpty ?? true
view.addSubview(tableView)
autoCompleteTableView = tableView
autoCompleteTableHeight = 100.0
}

@Przemex3000

@ghost
Copy link

ghost commented Oct 14, 2016

Unfortunately your code didn't work in my project -self.frame.origin.y still returns negative values which resulted in view appears in wrong place. I created my own solution - maybe not so good but works. I invoke function setupAutocompleteTable from superclasss when all constraints are set and TextField frame returns correct position.

Thanks for help @cnpetrich

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants