开发者

how to fetch data when user comes to the footerView in table(iphone)

I have made an uitableView and I am fetching data from json from a webservice

now i want that I get first 20 object first and load it in my tableView. it is happening properly

Now I want that when user scroll to the footer ..next 20 data should be fetched and it should be shown in tableView..

I am stuck here ..can anyone give me any idea how to 开发者_运维问答proceed next?


May be you can put Load more button in footerview and by tapping that you can load another 20 records from server ?

Another method is to implement Pull To Refresh and modify it as per your need.


You can use a ready made implementation of a UITableView with pull-to-refresh functionality.

Have a look at EGOTableViewPullRefresh or for a simpler implementation to PullToRefresh.

If you are interested in implementing this yourself, one approach is to add a subview to your UITableView (e.g., UILabel showing the "pull to refresh" message); then "intercept" the delegate methods when the user scrolls down (or up) and calculate whether the subview came into the viewable frame. Then issue the reload.

Another approach would be adding a last row to your table; then when the tableView:cellForRowAtIndexPath: method of your data source is called, return a cell with the "pull to refresh" message and do the refresh.

But you will be better off using one of the suggested implementations.


To know if you reached the button of the table (aka: seeing the footer) I think you could use this:

How to know when UITableView did scroll to bottom in iPhone

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜