我有收集視圖,如果單元格選擇,它下載一個PDF文件。下載完成並再次選擇該單元后,它會推送到另一個視圖控制器。但它不推動,有人可以解釋爲什麼嗎?不能instantiante並推送到另一個視圖控制器
這裏是我的代碼
if self.percentProgressFinal == 1.0 { //download complete
print("SUCCESS")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("NEXT")
self.navigationController?.pushViewController(vc, animated: true)
} else {
print("still downloading")
}
它成功打印「成功」,但不會代碼執行。我也嘗試使用禮物和這
let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let nextViewController: redirectMagazineViewController = storyBoard.instantiateViewControllerWithIdentifier("NEXT") as! redirectMagazineViewController // my second view controller name
self.navigationController?.pushViewController(nextViewController, animated: true)
仍然無法正常工作。我確定我的故事板ID是「NEXT」。
打印self.navigationController。看來你的導航控制器是零。 – pkc456
你有嵌入導航控制器嗎?你的故事板是什麼樣的? – WeiJay
我沒有使用導航控制器。我的故事板只是集合視圖,圖像和標籤,還有單元格內的進度視圖 –