के बाद रीफ्रेश नहीं किया गया है, मैंने अपने स्टोरीबोर्ड (आईपैड) में एक दृश्य देखा है जिसमें UICollectionView
है, दृश्य के निचले हिस्से में UIToolbar
भी है। UICollectionView
में मैंने UICollectionViewCell
(iPadCellCollectionViewCell
कक्षा द्वारा कार्यान्वित किया गया) जोड़ा है जिसमें कोर-प्लॉट ग्राफ (CPTGraphHostingView
क्लास) एक और दृश्य शामिल है।यूआईसीओलेक्शन दृश्य का सेल हमेशा स्क्रॉल
मेरे पास एक्स नामक एक वर्ग है जो UICollectionViewDelegate
और UICollectionViewDataSource
लागू करता है।
दसवीं कक्षा में, मैं मेरे विचार की प्रत्येक कोशिका (ViewDidLoad
में) कोर प्लॉट ग्राफ़ के लिए निर्माण और मैं UICollectionViewCell
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
static NSString* cellId = @"ChartCollectionId";
iPadCellCollectionViewCell* cell = [self.theCollectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
MyChart* chart = [_charts objectAtIndex:indexPath.row];
cell.hostingView.hostedGraph = chart.barChart;
return cell;
} की सेल करने के लिए ग्राफ लिंक करने के लिए निम्नलिखित कोड है
यह ठीक काम कर रहा है, मेरे सभी ग्राफ स्क्रीन पर सही ढंग से प्रदर्शित होते हैं। समस्या तब होती है जब उपयोगकर्ता दृश्य को स्क्रॉल करता है, फिर एक या कई कक्ष "रिक्त" बन जाते हैं। मैं वास्तव में समझ में नहीं आता क्यों।
मैं बजाय इंटरफ़ेस बिल्डर में UICollectionViewCell
में CPTGraphHostingView
जोड़ने की, एक समाधान पाया है, मैं इसे अपने आप और पिछले कोड हो जाता है का निर्माण:
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
static NSString* cellId = @"ChartCollectionId";
iPadCellCollectionViewCell* cell = [self.theCollectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath];
[cell.contentView addSubview:[_hostingViews objectAtIndex:indexPath.row]];
return cell;
}
के साथ इस कोड को सब कुछ है अच्छा कर रहा है। क्या कोई स्पष्टीकरण है कि यह काम नहीं कर रहा है जब मैं को UICollectionViewCell
में आईबी के साथ जोड़ रहा हूं?
क्या यह विधि हर बार "addSubview" को कॉल करने का मुद्दा है? कोई स्मृति रिसाव नहीं है?
मैं उस बग रिपोर्ट को कहां देखूं? – bandejapaisa