Paginación en UITableview en ios

I have a tableview in my application, into which I am loading different types of cells. I need to pass the page number to the service as one, two, etc. and to load that when the 1st page ends. For the first one I am loading the count is 10, after that when scroll ends I need to load the next. I am using Rest client Webservices. This is my json webservices.


preguntado el 12 de febrero de 14 a las 05:02

Seems like you have some good ideas, now just implement them buddy. -

What seems to be the problem ? -

@n00bProgrammer thanks for your response.I have no idea of how to using pagination to the uitableview using webservices.... -

2 Respuestas

Ok lets say you are pinging server for first 10 data and showing it into tableview now what you have to do.

  • Take a global int variable como int lastLoadedId=0;
  • When you parse your data simply store the last loaded id in lastLoadedId variable to track now where you are.
  • implementar el -(void)scrollViewDidScroll: (UIScrollView*)scrollView delegate method to know that you are at the bottom and you need new next data set.


-(void)scrollViewDidScroll: (UIScrollView*)scrollView
    float scrollViewHeight = scrollView.frame.size.height;
    float scrollContentSizeHeight = scrollView.contentSize.height;
    float scrollOffset = scrollView.contentOffset.y;

    if (scrollOffset + scrollViewHeight == scrollContentSizeHeight)
        // you are in the end ping server with lastLoadedId for new data


  • After getting new data set simply append them at the bottom of your tableview

Respondido 12 Feb 14, 09:02

thanks for your response.But i had small doubt.after parsing how to store the last loaded id.please clarify my doubt or any sample code. - user3222991

last loaded id means you have keep track that how much data is loaded into table view from server. - Pal de tapas

@Tatpas pal thanks for your response am getting request_id for each row which i have to pass as to get the requestid for last row in tableview... - user3222991

you must use an array. So simply pick the lastObject and get the last id. - Pal de tapas

@Tatpas Pal thanks for your response.But i had small doubt.How to get the lastOject ?please helpme.. - user3222991

The UITableView does not really have a concept of "pagination". It does have sections you might use. For example you could specify 10 sections with 10 cells (or rows) each. Each section can have a different number of cells.

Each section can have a header or a footer or both. You could put your page number into the footer of each section.

Respondido 12 Feb 14, 06:02

thanks for your response.But i have no idea this concept how to make this functionality.please give me any sample code or tutorial based on my above webservices... - user3222991

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.