I have a UICollectionView that implements lazy loading,
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{ [self loadImagesToVisiableCells]; }
It works well. However, the problem is before scrolling, the first few cells show substitute images. Therefore, I am trying to call loadImagesToVisiableCells on a callback to retrieve the json file, which will be displayed in the UICollectionView below,
- (void)handleReceivedData: (NSArray*)results returnArrayOrDic:(NSNumber *)returnArrayOrDic{ NSLog(@"***************************"); NSLog(@"handleReceivedData has been called from PromotionViewController"); NSLog(@"jsonArray Length:%d",[results count]); NSLog(@"jreturnArrayOrDic:%@",returnArrayOrDic); if([returnArrayOrDic boolValue] == YES){ for(NSDictionary *dealDic in results) { NSLog(@"dealDic: %@", dealDic);
A debug message is displayed before any scrolling, [[collectionView visibleCells] count] returns 0.
- (void)loadImagesToVisiableCells{ NSLog(@"starting loadImagesToVisiableCells, visibleCells:%d",[[collectionView visibleCells] count]); .... }
Any idea?
Relationship Hammer
source share