简体   繁体   中英

How to push ViewController on full screen from modally presented ViewController with navigation controller iOS 13?

I have a situation where I have three viewcontroller let suppose VC1, VC2 and VC3, and I presented VC2 on VC1 modally with navigation controller like

   let nav = UINavigationController(rootViewController: VC2)
   self.present(nav, animation:true)

What I want push VC3 overfullscreen from VC2 without changing the Presentation style of VC2 in iOS 13+. currently its overCurrentContext.

If you are adding the view controller VC3 as the root view controller of a navigation controller, then you need to modalPresentationStyle as overFullScreen to the navigation controller.

let nav = UINavigationController(rootViewController: VC3)
nav.modalPresentationStyle = .overFullScreen
self.present(nav, animation: true)

If you are directly presenting VC3, then do it like this.

VC3.modalPresentationStyle = .overFullScreen
self.present(VC3, animation: true)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM