UICollection View inside Table Cell does not show images in Swift 3

拥有回忆 提交于 2019-11-29 16:45:56

Edit controller like below, you are calling too many reloadData.

override func viewWillLayoutSubviews() {
    super.viewWillLayoutSubviews()
    self.tableView.layoutIfNeeded()
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

//getSearchWords()
    DispatchQueue.main.async {
        self.tableView.reloadData()
    }
    self.tableView.layoutIfNeeded()
}

override func viewDidLoad() {
        super.viewDidLoad()

    tableView.delegate = self
    tableView.dataSource = self
}

and add:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
            tableView .deselectRow(at: indexPath, animated: false)  
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!