-1

I'd like to present/show a ViewController (let's call it ViewController2) that is somehow hidden (or have a 0 size) and, after some time, it'll be resized to a specific size (or fullscreen) meanwhile keeping the content of the ViewController (let's call it ViewController1) presenting/showing it interactive.

ViewControllers flow


Just to give some more context on why I want to do that.

I'm trying to load a WKWebView in the background and, ideally, would like to present the ViewController only when the webview is fully loaded. Unfortunately, iOS seems to "pause" javascript evaluation and its timers after a very short time when the webview is not presented to the user.

I can confirm code like setTimeout stop working when the webview is attached to a ViewController which is not presented to the user and resumes working when that controller is presented/shown.

My idea here is, presenting the controller right away but somehow hidden (while keeping the app interactive) and when getting the right signal from the webview, I'd show/resize it to the user.

André Herculano
  • 1,111
  • 20
  • 28

1 Answers1

0

If you are doing it using Xcode 11 then present your view controller modally.

 let changevc = UIViewController() // change this code as this is  your view controller with edit button
 changeVC.modalPresentationStyle = .automatic // .popover
 self.present(changeVC, animated: true, completion: nil

You can try different types of modals from this site and use whichever you find best. https://developer.apple.com/documentation/uikit/uimodalpresentationstyle

Reed
  • 770
  • 4
  • 12
  • Presenting another view controller modally will not let you interact with the view controller from where you are presenting the modal controller. But Andre wants that to be interactive. – Subramanian Mariappan Oct 22 '19 at 01:48