मैं एक UICollectionView कि मैं आलसी लोड हो रहा है को लागू करने से पहले रिटर्न 0,UICollectionView visibleCells स्क्रॉल
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
[self loadImagesToVisiableCells];
}
यह अच्छा काम करता है। हालांकि, समस्या किसी भी स्क्रॉल से पहले है, पहले कुछ कक्ष प्लेसहोल्डर छवियों को दिखाते हैं। इसलिए मैं json फ़ाइल को पुन: प्राप्त नीचे UICollectionView में प्रदर्शित करने के लिए की मेरी कॉलबैक पर loadImagesToVisiableCells कॉल करने के लिए,
- (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);
//to populate the dealArray
Deal *deal = [[Deal alloc] initWithDict:dealDic];
[dealArray addObject:deal];
}
NSLog(@"%d deals have been populated to dealArray",[dealArray count]);
}else{
NSDictionary *jsonDictionary = (NSDictionary *)results;
for(id key in jsonDictionary) {
id value = [jsonDictionary objectForKey:key];
NSString *keyAsString = (NSString *)key;
NSString *valueAsString = (NSString *)value;
NSLog(@"key: %@", keyAsString);
NSLog(@"value: %@", valueAsString);
}
}
[self.collectionView reloadData];
[self loadImagesToVisiableCells];
}
डीबग संदेश किसी भी पुस्तक से पहले से पता चलता कोशिश, [[collectionView visibleCells] गिनती] रिटर्न 0.
- (void)loadImagesToVisiableCells{
NSLog(@"starting loadImagesToVisiableCells, visibleCells:%d",[[collectionView visibleCells] count]);
....
}
कोई विचार?
सादर हथौड़ा
धन्यवाद! इसे –
ढूंढना आसान बनाने के उत्तर के रूप में इसे सेट करें इसे पोस्ट करने के लिए धन्यवाद! – yash