Reputation: 11
I have SplashScreenController where it has progress bar. And I want to preload web view while progress bar ends. Also I have WebViewController where I load web view.
So as I understood I have to load web view in SplashScreenController. How I can get WebViewController view in SplashScreenController
Upvotes: 0
Views: 313
Reputation: 351
Do webviewcontroller as a starting. Start downloading web content on it. From above, put a view on the whole screen, with a progress bar. Upon completion of the progress bar, simply delete the subview. Will remain webviewcontroller loaded with content. With Splash screen you cannot do anything, because as long as it is present, in AppDlegate didFindishLaunchingWithOptions method not called and the application does not exist
Upvotes: 0
Reputation: 165
In my experience a UIWebView won't start loading content unless it is in the view hierarchy. It doesn't mean it has to be visible, I usually put them off screen and show them only when load is completed. You can put the UIWebView in a different UIViewController, as long as that VC is loaded. The Splash screen can stay on top and be connected either to the same VC as the web view or to a different one (I'd suggest the second approach)
Upvotes: 1
Reputation: 7588
You cannot do that way. Basically, what you need to do is load WebViewController first, and at same time (on viewDidload for example), load the SplashScreenController as Modal. This way you can send message from WebViewController to SplashScreenController (ie, progress of loading, etc).
Upvotes: 1