Hi,
I want to use a single instance of a subclass of UIView (so that it doesn't have to be redrawn) as the background of the cells of my UICollectionView. The way I have set it up is, in the UICollectionView, declare a variable (nonatomic, strong) of the class for my background view. In viewDidLoad, I initialize the view with the frame (0, 0, width, height). In my subclass of UICollectionViewCell, I have a variable declared for the background (nonatomic, weak). Then back in my CollectionView, in the cellForIndexPath method, I assign the initialized background view to the cell's background view and call "setNeedsDisplay" to force a redraw. This works, but only for the first cell, not any other. Is my approach correct?
I want to use a single instance of a subclass of UIView (so that it doesn't have to be redrawn) as the background of the cells of my UICollectionView. The way I have set it up is, in the UICollectionView, declare a variable (nonatomic, strong) of the class for my background view. In viewDidLoad, I initialize the view with the frame (0, 0, width, height). In my subclass of UICollectionViewCell, I have a variable declared for the background (nonatomic, weak). Then back in my CollectionView, in the cellForIndexPath method, I assign the initialized background view to the cell's background view and call "setNeedsDisplay" to force a redraw. This works, but only for the first cell, not any other. Is my approach correct?