开发者

issues with UITableView performance

开发者 https://www.devze.com 2023-03-04 13:55 出处:网络
I am pulling data from a web service in order to populate my UITableView rows. It loads perfectly fine, however it 开发者_运维问答takes around 4 seconds in order to load the whole data. Is there a way

I am pulling data from a web service in order to populate my UITableView rows. It loads perfectly fine, however it 开发者_运维问答takes around 4 seconds in order to load the whole data. Is there a way in that I can increase the time to load? Probably by caching it? Or any tips and tricks on what people usually do to do this?


You can display old data and asynchronously fetch using threads the new data and then reload the UITableView


Caching depends on what you're loading. If you're loading, say, Twitter feeds, you should cache the user avatar pictures because you know you'll be fetching them over and over again. If you're writing something like a retail app, you might show items that are on sale. If the items change every Sunday, then cache them the first time you fetch them and don't fetch them again until Sunday. That sort of thing.

Beyond that, there's not much you can do to make the internet faster. If you have control over the web service, you can make the data sent back as concise and simple as possible. You'd be surprised how many milliseconds you can burn parsing complicated XML.

If it makes sense for your app, you can show old data. For a twitter client, it's better to just save the data you've already fetched, show it immediately, and load the new stuff in the background.

If you can't do any of that, then pretty much all you can do is put up a "Loading..." overlay of some sort so that the app doesn't just look frozen and live with the delay.


You can try to use Three20 TTTableViewController, nice tutorial can be found here: Three20

Moreover, you can add "Load more results" button, look here

0

精彩评论

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