Reputation: 7337
Apple has flagged the app I'm working on because it takes (or can take) a while for the content to load into a UIWebView
, meanwhile the user is stuck looking at a blank screen. I'm using the standard UINavigationController
framework and pushing the viewController for webView from what I'll call the mainMenuController.
Is there any way that I can pre-load the content of the webView from the mainMenuController (before the webView shows), so there's no delay once the transition to the webViewController happens?
Upvotes: 1
Views: 908
Reputation: 869
In the view did load you call and make the respective loading functionality of the web view and then in
webViewDidFinishLoad method you just call the following code
[self.view addSubview:self.webview];
this works fine after the complete loading of webdata's it will show the view with finished data's.
Upvotes: 0
Reputation: 726479
I don't think that Apple is necessarily against the slow-loading content as much as they are against the blank screen.
One way to fix this problem would be adding a placeholder HTML to your app, with a message that says that the actual data is being loaded. Load the bundled "Please wait" HTML from a file in your bundle (here is how to do it), then start the actual load. To get really fancy, add an activity indicator.
If you know that you are always loading the same view from the web, you may want to cache some or all of it, then load the cached version from a file for quick viewing, and start the reload in the background.
Upvotes: 2
Reputation: 3271
You could create the UIWebView
and load it before you push the new view controller. Then when you instantiate/push the view controller, you can pass the web view to the destination view controller, and add it as a subview.
Upvotes: 0