KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have defined in my Storyboard (iPad) a view that contains a UICollectionView , at the bottom of the view there's also a UIToolbar . In the UICollectionView I have added a UICollectionViewCell (implemented by an iPadCellCollectionViewCell class) that contains a another view that is a Core-Plot Graph (a CPTGraphHostingView class). I have a class called X that implements the UICollectionViewDelegate and UICollectionViewDataSource . In the class X, I build for each cell of my view (in ViewDidLoad ) the Core-Plot Graph and I have the following code to link the graph to the cell of the 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; } It's working fine, all my Graphs are correctly displayed on the screen. The issue happens when the user scroll the view, then one or several cells become "blank". I really don't understand why. I have found a workaround, instead of adding the CPTGraphHostingView in the UICollectionViewCell in the Interface Builder, I build it myself and the previous code becomes: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { static NSString* cellId = @"ChartCollectionId"; iPadCellCollectionViewCell* cell = [self.theCollectionView dequeueReusableCellWithReuseIdentifier:cellId forIndexPath:indexPath]; [cell.contentView addSubview:[_hostingViews objectAt
Tags (comma-separated)
Save Edits
Cancel