It is because yout getting new refrence of your progress view at didSelectItemAtIndexPath. what about previous refrence of progrress view.
You can add all progress view in NSDictionary with keyvalue index path. And in checkDownload pass your index path then get that progress view from NSDictionary with passed index path and use it
//Initialize you NSMutable dictionary somewhere else And add progress view either in
- (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"ArticleCell" forIndexPath:indexPath];
pv = [[UIProgressView alloc]init];
[dictionary setObject:pv forKey:indexpath];
}
Or you can add progress view in
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
//to show progressview in cell..
UICollectionViewCell *selectedCell = [collView cellForItemAtIndexPath:indexPath];
NSLog(@"subviews - %@",selectedCell.contentView.subviews);
pv = (UIProgressView *)[selectedCell.contentView.subviews objectAtIndex:0];
pv.hidden = NO;
[dictionary setObject:pv forKey:indexpath];
[self performSelector:@selector(checkDownload) withObject:indexpath afterDelay:1.0];
}
Customize you checkDownload with
-(void)checkDownload:(NSIndexPath*)indexpath
{
pv = [dictionary objectForKey:indexpath];
}