无法实例化并推送到另一个视图控制器

时间:2021-06-05 15:01:41

i have collection view and if cell selected, it downloading a pdf file. After download completed and select the cell again, it push to another view controller. But it doesnt push, can someone explain why?

我有集合视图,如果选择了单元格,则下载pdf文件。下载完成后再次选择单元格,它将推送到另一个视图控制器。但它没有推动,有人可以解释为什么?

here's my code

这是我的代码

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")
}

It successful printing "SUCCESS" but the code wont execute. I Also try use present and this

它成功打印“SUCCESS”但代码不会执行。我也尝试使用礼物和这个

    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)

and still doesnt work. I'm sure my storyboard id is "NEXT".

仍然不起作用。我确定我的故事板ID是“NEXT”。

2 个解决方案

#1


1  

Seems like you don't have navigation controller embedded.

好像你没有嵌入导航控制器。

无法实例化并推送到另一个视图控制器

#2


0  

Did you check the button " use storyboard id" on your Identity Inspector view controller?

您是否在Identity Inspector视图控制器上选中了“使用storyboard id”按钮?

#1


1  

Seems like you don't have navigation controller embedded.

好像你没有嵌入导航控制器。

无法实例化并推送到另一个视图控制器

#2


0  

Did you check the button " use storyboard id" on your Identity Inspector view controller?

您是否在Identity Inspector视图控制器上选中了“使用storyboard id”按钮?