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 UICol
I've had a similar issue. I fixed it by forcing a repaint when setFrame:
is called on my custom content. In your case, subclass CPTGraphHostingView
and override this method:
-(void)setFrame:(CGRect)frame {
[super setFrame:frame];
[self setNeedsDisplay]; // force drawRect:
}
Edit: An easier way to refresh cell views when they are reused is to override applyLayoutAttributes:
in iPadCellCollectionViewCell
as follows:
-(void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes {
// apply custom attributes...
[self.hostingView setNeedsDisplay]; // force drawRect:
}
Regarding your workaround: there will be more and more subviews in the content view, which probably isn't a good thing. However, if you'd remove any old subview before adding the new one, that should be OK, too.