Look at SDWebImage. It'll handle all the asynchronous loading of the images from the web.
Objective c - Reload collection view async
-
24-06-2023 - |
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];
}
}
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow