我疯了,因为我只能使用模态弹出窗口。我的目标是将destinationVC保留在导航和tabbarcontroller中。
从我所有评论的代码中可以看出,我已经尝试了很多。有些代码会使应用程序崩溃,有些代码在点击单元格时根本不会产生影响。
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let Storyboard = UIStoryboard(name: "Main", bundle: nil)
let DestinationViewController : PlayEpisodeViewController = Storyboard.instantiateViewController(withIdentifier: "PlayEpisodeViewController") as! PlayEpisodeViewController
DestinationViewController.getEpisodeName = episodesArray[indexPath.row].EpisodeName
DestinationViewController.getEpisodeFileURL = episodesArray[indexPath.row].EpisodeURL
DestinationViewController.getEpisodeImage = episodesArray[indexPath.row].EpisodeImage
let navController = UINavigationController(rootViewController: DestinationViewController)
//UIApplication.shared.keyWindow?.rootViewController?.show(navController, sender: Any?.self)
//.pushViewController(DestinationViewController, animated: true)
UIApplication.shared.keyWindow?.rootViewController?.present(navController, animated: true, completion: nil)
//performSegue(withIdentifier: "playEpisodeSegue", sender: self)
//shouldPerformSegue(withIdentifier: String, sender: self)
//show(navigationController, sender: Any?.self)
//present(navigationController, animated: true, completion: nil)
}