将 ViewController 推入显示英雄动画的视图中
Push ViewController inside View that was presented with hero animation
标题几乎说明了一切。我有一个 ViewController
,我 present
是这样的:
let communityVC = self.storyboard?.instantiateViewController(withIdentifier: "CommunityVC") as! CommunityViewController
communityVC.hero.modalAnimationType = .zoomSlide(direction: .right)
let addButtonHeroID = "addWishButtonID"
self.addButton.heroID = addButtonHeroID
communityVC.homeButton.heroID = addButtonHeroID
self.present(communityVC, animated: true, completion: nil)
问题是 comunityVC
我想 push
另一个 ViewController
。这有可能吗?我真的找不到有效的 Swift
解决方案。
嵌入UINavigationController
后需要呈现communityVC
,然后可以在communityVC
中推送视图控制器,因此可以使用[=推送ViewController 14=] 来自 communityV
let communityVC = self.storyboard?.instantiateViewController(withIdentifier: "CommunityVC") as! CommunityViewController
let navController = UINavigationController(rootViewController: communityVC)
communityVC.hero.modalAnimationType = .zoomSlide(direction: .right)
let addButtonHeroID = "addWishButtonID"
self.addButton.heroID = addButtonHeroID
communityVC.homeButton.heroID = addButtonHeroID
self.present(navController, animated: true, completion: nil)
标题几乎说明了一切。我有一个 ViewController
,我 present
是这样的:
let communityVC = self.storyboard?.instantiateViewController(withIdentifier: "CommunityVC") as! CommunityViewController
communityVC.hero.modalAnimationType = .zoomSlide(direction: .right)
let addButtonHeroID = "addWishButtonID"
self.addButton.heroID = addButtonHeroID
communityVC.homeButton.heroID = addButtonHeroID
self.present(communityVC, animated: true, completion: nil)
问题是 comunityVC
我想 push
另一个 ViewController
。这有可能吗?我真的找不到有效的 Swift
解决方案。
嵌入UINavigationController
后需要呈现communityVC
,然后可以在communityVC
中推送视图控制器,因此可以使用[=推送ViewController 14=] 来自 communityV
let communityVC = self.storyboard?.instantiateViewController(withIdentifier: "CommunityVC") as! CommunityViewController
let navController = UINavigationController(rootViewController: communityVC)
communityVC.hero.modalAnimationType = .zoomSlide(direction: .right)
let addButtonHeroID = "addWishButtonID"
self.addButton.heroID = addButtonHeroID
communityVC.homeButton.heroID = addButtonHeroID
self.present(navController, animated: true, completion: nil)