开发者

UITableView - Loading data from internet

I have seen many apps that load data to UITableViews from the internet, and they usually load smoothly. Now it's my turn to load in that kind of data. I am getting different data at the same time, separating categories with ~ and pieces of categories with #. This wo开发者_如何转开发rks great, and I have managed to separate the data in obj-c perfectly.

Everything in my app works, it's just that the loading takes a lot of time.

So, I guess the real question is, how can you load in data for a tableView in the background, showing a label/UIActivityView or something while it is loading?

Thank you.


The simplest way is to add a temporary cell which shows some kind of loading progress (label with 'Loading...' text, or a UIActivityIndicator, etc). When your data is done loading, remove that cell and add your actual cells with your data.

To load data 'in the background' I would recommend having a look at NSURLConnection. It lets you implicitly load the data asynchronously so you don't have to deal with threads.


I am not getting your question clearly. Why don't you use UIActivityIndicator to show the loading. You can do it from your nib or programmatically. One ting is also possible that you can load the contents From intenet by using NSXMlParsing which will be much quiker and show an activity indiacator until all date gets parsed and filling the table entirely at once.

Do reply if you get this.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜