Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto loading data when scrolling down in ios application

Tags:

ios

iphone

I am trying to do the following in my application:

I got my data from an online server, and I put them in cells, What I need is to auto loading the data when scrolling down, means for example 10 cells are loaded when the application is running, then when I scroll down 10 other cells are dynamically loaded.

Like the following example:

enter image description here

Thank You per advance,

like image 368
CarinaM Avatar asked Dec 21 '22 06:12

CarinaM


1 Answers

You can implement this method inside your view controller and get your next record

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{

        if (([scrollView contentOffset].y + scrollView.frame.size.height) >= [scrollView contentSize].height){

            // Get new record from here
        }
}

This is the simplest way to implement paging. if you want to add Activity indicator at the bottom, you can add it inside the same function.

like image 70
Vinod Singh Avatar answered Dec 22 '22 19:12

Vinod Singh