简体   繁体   中英

Prevent Dismissal of Modally Presented ViewController

I am presenting a viewcontroller modally and am trying to configure it where, when I re-enter the foreground after going to the background (ie I click a website link that redirects me out fo the app and then I navigate back to the app), I don't want the presented viewcontroller to be dismissed.

Is the only option to create a navigationcontroller stack? Hoping for a solution without this, and I couldn't find any existing commentary around this/am fairly new to all this. Any advice would be helpful.

My view hierarchy is...

  1. Root MainTabBarVC

  2. Load DummyMenuVC into MainTabBarVC viewcontrollers

  3. Present on shouldSelect tabBarControllerDelegate method RealMenuVC

  4. Tap RealMenuVC Button to present NextVC

I have #2 & #3 to be able to interact with the menu over the full context of any tabBarItem selected.

Learned a presented vc isn't dismissed just because it goes into the background mode, and that something must have been programmatically integrated to trigger it.

I traced my issue to a notificationCenter observer I had included, which invoked a function that dismissed presented vcs.

这个解决方案对我有用

modalPresentationStyle = .overCurrentContext

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