Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
479 views
in Technique[技术] by (71.8m points)

ios - Calling web service on Scrolling UITableView

Totally Confused !!!...

I have one web-service that accepts the pageNumber as Parameter and gives me some records as JSON response. (This service basically implements the functionality of Paging for Silverlight version.) I want to load these pages one by one when user scrolls the UITableView (means Load the next 20 entries (or second page) when user scrolls).

My Problem :

How and Where to call this service and How to calculate pageNumber ?

I searched about this but didn't get any Satisfied answer.

What I found is :

  1. How to call web service after each certain number of data received and load it into table view
  2. Load more data from a web service when the user scrolls the UITableView
  3. how to add elements to tableview on scrolling iphone?

I would love to here your responses in Objective-C Language.

Any Suggestions ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Take one integer set it to 0. Now Used Pull to refresh functionality (Pull To refresh exmaple).

Now in API side you have to set the two extra parameter like pagenumber and pageSize

At very first time you call API with pageNumber=0 and pageSize=20

Now when you pull the table then you have a particular method in which you have to call the API with pageNumber++ and pageSize=20 again and whatever you get in the response add into your NSMutableArray. If you found nothing then remove pull to refresh option


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...