self.tableView.reloadData() not working in Swift

前端 未结 10 1033
离开以前
离开以前 2020-12-23 09:12

I\'m attempting to learn Swift & the basics of iOS dev at the same time, so bear with me. I\'ve got a TableViewController that is

10条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-23 09:59

    If your connection is in background thread then you should update UI in main thread like this

    self.tblMainTable.performSelectorOnMainThread(Selector("reloadData"), withObject: nil, waitUntilDone: true)
    

    As I have mentioned here

    Swift 4:

    self.tblMainTable.performSelector(onMainThread: #selector(UICollectionView.reloadData), with: nil, waitUntilDone: true)
    

提交回复
热议问题