मैंने संग्रह दृश्यों का उपयोग करके एक आरएसएस रीडर एप्लिकेशन विकसित किया है। मेरी समस्या है, पहले लॉन्च पर, ऐप खाली हो गया है।मैं स्वचालित रूप से संग्रह दृश्य को पुनः लोड कैसे करूं?
प्रक्रिया है, आरएसएस फ़ीड वेब से खींचा जाता है, डिवाइस पर एक अस्थायी फ़ाइल में संग्रहीत किया जाता है और फिर संग्रह दृश्यों के माध्यम से प्रदर्शित किया जाता है।
मेरा प्रश्न यह है कि फ़ाइलों को लोड होने के बाद मैं स्वचालित रूप से डेटा को पुनः लोड करने के लिए ऐप कैसे प्राप्त करूं? ताकि उपयोगकर्ता को प्रारंभिक खाली स्क्रीन दिखाई न दे।
मैं इस कोड
[self.collection1 performBatchUpdates:^{
[self.collection1 reloadSections:[NSIndexSet indexSetWithIndex:0]];
} completion:nil];
हालांकि यह प्रारंभिक दृश्य के लिए काम नहीं करता जोड़ने की कोशिश की है।
क्या मुझे अपर्याप्त से कुछ करना चाहिए? या संग्रह दृश्य नियंत्रक से ही?
कृपया सलाह
नीचे लाने के लिए और अपने डेटा प्रदर्शित करने के लिए इस्तेमाल किया कोड है ....
#pragma mark - UICollectionViewDataSourceDelegate
- (NSInteger) numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
return 1;
}
- (NSInteger) collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
return [_articleListmain count];
}
- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
MainCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"articleCellmain"
forIndexPath:indexPath];
NSDictionary *item = [_articleListmain objectAtIndex:indexPath.item];
// set the article image
[cell.image setImageWithURL:[item objectForKey:@"image"]];
// set the text of title UILabel
cell.title.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"title"]];
cell.title.textColor = [UIColor colorWithRed:33.0f/255.0f green:74.0f/255.0f blue:146.0f/255.0f alpha:1.0f];
// set the text of summary UILabel
cell.description.text = [NSString stringWithFormat:@"%@\n\n\n\n\n\n\n\n\n", [item objectForKey:@"description"]];
cell.targetURL.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"link"]];
cell.category.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"category"]];
cell.date.text = [NSString stringWithFormat:@"%@\n\n\n\n", [item objectForKey:@"pubDate"]];
cell.image.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"placement.png"]];
return cell;
}
तो क्या मैं इसे संग्रह दृश्य नियंत्रक में उपयोग करता हूं या डेटा को पार्स करने के बाद। मेरी समस्या है जो मैं कर रहा हूँ। –
ने कोशिश की कि मेरे संग्रह दृश्य में और लॉग दिखाता है कि यह फिर से लोड हो जाता है लेकिन डिस्प्ले प्रदर्शित नहीं करता है रिक्त प्रदर्शन –
कोड को देखे बिना, मैं वास्तव में नहीं जानता कि डेटा के समय मौजूद नहीं होने के कारण यह क्या होगा लोड करें। आपके सेलफोरइटम एट इंडेक्सपैथ में, क्या आपने यह देखने के लिए अपना डेटा स्रोत (जो कुछ भी हो सकता है) का निरीक्षण किया है? शायद आप उस विधि के लिए कोड शामिल करने के लिए अपनी पोस्ट को संशोधित करना चाहते हैं। – RegularExpression