我在ViewControllerA
let layout = UICollectionViewFlowLayout()
let controller = ViewControllerB (collectionViewLayout: layout)
controller.contentData = self.users_cities[indexPath.row].content
self.navigationController?.pushViewController(controller, animated: true)
现在,当调用let controller = ViewControllerB (collectionViewLayout: layout)
时,会执行viewDidLoad
ViewControllerB
方法,并为ViewControllerB
设置用户界面。问题是这会使ViewControllerA
的用户界面在推出ViewControllerB
之前冻结几秒钟。是否有不同的方法来避免这个问题?自然的解决方案是在后台线程上运行它,但据我所知,你不应该在后台线程上设置视图。