相關:Is it ok to create a UIView on a background thread?可以在後臺線程上創建一個UIViewController嗎?
這是後臺線程代碼安全嗎?
let viewController = MyViewController(nibName: nil, bundle: nil)
viewController.title = "My Title"
viewController.myProperty = true
dispatch_async(dispatch_get_main_queue(), {
self.navigationController?.pushViewController(viewController, animated: true)
})
謝謝! :-)那麼,'MyViewController(nibName:nil,bundle:nil)'不會觸發任何UI更新? 'viewController.myProperty = true'沒有副作用。這只是一個簡單的屬性。 – ma11hew28