5
我的圖像下載時顯示UIAlertController。下載完成後,我想推送視圖控制器。我有一個錯誤在控制檯,因爲我不解除警報控制器:如何在SWIFT中不使用任何操作來解除UIAlertController?
pushViewController:animated: called on <UINavigationController 0x7fb190c6ee00> while an existing transition or presentation is occurring; the navigation stack will not be updated.
在我的主視圖控制器,當下載完成後,我把另一種觀點認爲:
override func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
//....
var alert = UIAlertController(title: "Alert", message: text, preferredStyle: UIAlertControllerStyle.Alert)
self.presentViewController(alert, animated: true, completion: nil)
dispatch_async(dispatch_get_main_queue(), {
if let cellToUpdate = tableView.cellForRowAtIndexPath(indexPath) {
self.performSegueWithIdentifier("postview", sender: self)
}
})
}
我試圖機智dismissViewControllerAnimated但我有完全一樣的錯誤:
dispatch_async(dispatch_get_main_queue(), {
if let cellToUpdate = tableView.cellForRowAtIndexPath(indexPath) {
alert.dismissViewControllerAnimated(true, completion: nil)
self.performSegueWithIdentifier("postview", sender: self)
}
})
它的工作原理!謝謝 ! – cmii 2014-12-06 18:06:58
我也有同樣的問題,@ dasblinkenlight.Can你幫我嗎?這是我的鏈接:http://stackoverflow.com/questions/30840235/console-warning-in-my-custom-alert-controller-which-說 - 這 - 是 - 嘗試對prese – 2015-06-15 08:59:22