2016-08-04 59 views
1

我有收集視圖,如果單元格選擇,它下載一個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」。

+0

打印self.navigationController。看來你的導航控制器是零。 – pkc456

+0

你有嵌入導航控制器嗎?你的故事板是什麼樣的? – WeiJay

+0

我沒有使用導航控制器。我的故事板只是集合視圖,圖像和標籤,還有單元格內的進度視圖 –

回答

1

好像你沒有嵌入導航控制器。

enter image description here

0

您是否在Identity Inspector視圖控制器上檢查了按鈕「use storyboard id」?

+0

是的,我檢查了它 –

+0

在終端打印的錯誤是什麼? –

+0

沒有錯誤,只是不能移動到另一個視圖控制器。如果我選擇了單元格,沒有任何反應 –

相關問題