Question

I have a collection view with many pictures from Facebook.

It takes alot of time for the collection to load & show the pictures.

How can I show the pictures one by one without waiting for the end of the process?

This is my code:

-(void)viewDidAppear:(BOOL)animated
{
    NSMutableArray *jpegFiles = [[NSMutableArray alloc]init];

    NSMutableArray *picsArr =[[NSMutableArray alloc] initWithArray:[LocalUser sharedUser].profilePics];

    for(NSString *picLink in picsArr)
    {
        [jpegFiles addObject:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:picLink]]]];
        self.dataArray = jpegFiles;
        [self.collectionView reloadData];
    }
}
Was it helpful?

Solution

Look at SDWebImage. It'll handle all the asynchronous loading of the images from the web.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top