如何在显示启动画面时从Web服务加载数据? [英] How to load data from web-service while displaying splash screen?

查看:120
本文介绍了如何在显示启动画面时从Web服务加载数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在应用启动时从网站加载一些数据。我设置了一个启动画面,在didFinishLaunchingWithOptions中我设置了sleep(10)。现在我希望在这个时间间隔内我的应用程序调用Web服务并加载数据,但我无法做到这一点。请帮帮我或提出任何建议。

I want to load some data from web at the starting of my app launch. I have set a splash screen and in didFinishLaunchingWithOptions I have set the sleep(10). Now I want that in this time interval my app call the web service and load the data but I am not able to do this. Please help me out or give any suggestion to do it.

推荐答案

在睡眠期间,线程(在本例中为主线程)无法执行任何操作。

During sleep, the thread (in this case, the main thread) is unable to do anything.

我建议您只需显示启动画面,开始加载数据并在加载完所有数据后隐藏启动画面。

I would recommend you simply show the splash screen, start loading the data and hide the splash screen once all the data has been loaded.

这篇关于如何在显示启动画面时从Web服务加载数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆