ios - UITableViewCells not displaying first time -


i'm trying create autocompleter using ios 8, swift , xcode 6.3

i have problem i'm trying solve, gave up... hope can here. problem (custom) uitableviewcell's not displaying when initial datasource empty. when adding data datasource , reloading tableview, cells should display, don't... @ least, first time don't... second time, do... when initialize table non-empty data, problem doesn't occur. guess goes wrong dequeuereusablecellwithidentifier. in beginning, no reusable cells found, or something. don't know why...

relevant code, in viewcontroller.swift:

// filteredwords [string] 0 or more items  @ibaction func editingchanged(sender: uitextfield) {     autocompletetableview.hidden = sender.text.isempty     filteredwords = datamanager.getfilteredwords(sender.text)     refreshui() }  func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     let cell = tableview.dequeuereusablecellwithidentifier("cell") as! autocompletetableviewcell     cell.title.text = filteredwords[indexpath.row]     return cell }  func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {     return filteredwords.count }  func refreshui() {     self.autocompletetableview.reloaddata() } 

i created sample project on github:

https://github.com/dirkpostma/swift-autocomplete

and movie on youttube show goes wrong:

https://www.youtube.com/watch?v=bymsy4aahyi

can @ , spot bug...?

thanks in advance!

you've accidentally hidden cell.

  1. open main.storyboard
  2. select cell
  3. uncheck hidden

side note: why it's displaying second time around cell hidden? appears bug. should still hidden (print cell.hidden, notice it's true despite showing text on screen).


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -