Why is data not displayed when viewDidLoad finished in swift? [closed]

廉价感情. 提交于 2019-12-20 08:03:20

问题


When my application finished being launched, there are supposed to be data displayed on UITableViewCell. However, there is nothing there, so after relaunch the app, by pressing home button and swiping up the view, and select my demo app, all data is shown up properly and there seems like nothing is wrong. What causes the initial problem? Do you have any ideas why?


回答1:


Did you set the tableView.dataSource to self? Also, you need to call tableView.reloadData() for populating the datas. Hope this helps.




回答2:


When you use UITableView, dont forget to call self.tableView.reloadData() after downloading data.



来源:https://stackoverflow.com/questions/40289456/why-is-data-not-displayed-when-viewdidload-finished-in-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!