开发者

Approach regarding web service call restricted to the visible cell only

开发者 https://www.devze.com 2023-04-02 03:58 出处:网络
creating a listing component(a tabl view) for iPhone app, the list content must be dynamic (can be read from a web service or local开发者_开发问答 file system) and the app should only fetch the conten

creating a listing component(a tabl view) for iPhone app, the list content must be dynamic (can be read from a web service or local开发者_开发问答 file system) and the app should only fetch the content that is viewable in the list(table) view and each scroll will request for more data from the server(file system or web service). The viewable content should auto-refreshed every 30 seconds.

till now i am successfull in creatin table view with dumy data(from an array). But what approach should i take foe requesting web service only viewable to the current cell , any guidence here will be very appreciated.


To solve your problem I will suggest following steps.
1. Keep one data array and keep refreshing you table sing that every 30 sec, as you have already done.
2. Make a separate thread for calling web service and update you array when response comes available.
Thus, even if internet is down some time or slow, your GUI will not be affected with that.
3. Make sure your array is being accessed synchronously between threads.
4. if web service content is too big, then keep version number for data and send request with current version no. so if web service has updated version of data it will send you only updates or difference. OR it will send you all the data on condition that your current version is older.

If answer is not relevant than please post further details so that I can have better understanding of problem.

0

精彩评论

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