I have set the color of a UICollectionView with an image pattern like so:
self.collectionView.backgroundColor = [UIColor colorWithPatternImage:image];
I would like to set the alpha of the collectionView without affecting the alpha of the UICollectionViewCell. Is there a way to do this? Setting the alpha of collectionView also affects the UICollectionViewCell, so I already tried that. What else should I try/what else will actually work?
Thanks for any tips.
Use the -colorWithAlphaComponent: method of UIColor:
[self.collectionView setBackgroundColor:[[UIColor redColor] colorWithAlphaComponent:0.5]];
This will result in only the background having a non-1 alpha value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With