开发者

How to load multiple web pages in the background of an iPhone/Android app?

开发者 https://www.devze.com 2023-04-11 11:57 出处:网络
We would like to load web pages in the background of an iPhone app. Use case: 1) User opens iPhone app and sees a \"loading\" icon on the home screen. In the background, the app loads up five web pa

We would like to load web pages in the background of an iPhone app.

Use case:

1) User opens iPhone app and sees a "loading" icon on the home screen. In the background, the app loads up five web pages.

2) When all five web pages are loaded, the app is notifi开发者_运维技巧ed and switches the view from the home screen to one of the web pages.

How can this be done?

How can this be done for an Android app?


For iPhone, create five UIWebView instances off-screen & load the URLs you need. When the delegate method webviewDidFinishLoad: hits five times, you are done.


for iPhone You can create a View Controller that contains 5 UIWebView View components and the loading icon view. Set the delegate of each UIWebView to the controller add the loading icon to the controllers view.

In the "- (void)webViewDidFinishLoad:(UIWebView *)loadedWebView;" delegate method keep track of which webView has finished loading the HTML content and once all 5 webviews have finished loading their content, remove the loading icon and add one of the web views at a subview to the controllers view.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号