ios - UITableView not refreshing on reloadData -
note: have read similar questions, none of answered question specifically. have been trying understand why uitableview not refreshing when data pieces added list. checked (through print() statements) , everytime call tableview.reloaddata()
, checks length of array use, , nothing there. tried using function instead:
func refreshui() { dispatch_async(dispatch_get_main_queue(),{ self.tableview.reloaddata() }); }
which found on answered question, did not fix situation. problem override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {}
never getting called, though
override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int {}
is returning non-zero number when should.
code new info added list , should displayed:
self.firebase.observeeventtype(.value, withblock: { (snap) in print("\n\n\n\n\n\nsnap recieved firebase: \n\n\(snap)\n\n") var count = int(self.names.count) var childcount = int(snap.childrencount) print(childcount) print(self.names) print("names count: \(self.names.count)") self.names.removeall() child in snap.children { let c = child as! anyobject self.names.append(c.key!) } self.refreshui() })
numberofrows method:
override func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { print("for tableview size, returning \(self.names.count)") return self.names.count }
Comments
Post a Comment