Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 843
golu_kumar Avatar asked Oct 26 '25 09:10

golu_kumar


1 Answers

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)
like image 90
Sumesh Sivan Avatar answered Oct 28 '25 22:10

Sumesh Sivan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!