I try to avoid the white background color on top of my collectionview cell if the user scrolls down (basicly when it bounced). So on top of my cell is only the collectionview background color visible. But as shown in the picture I need 2 different colors. For the first section the background should be blue so the gap isn't white but blue and for the other sections it should remain white. So all I want is that the gap in white will become blue without changing the complete backgroundcolor of my uicollectionview.
You can achieve the desired effect by adding a view to the top your UICollectionView or UITableView - it will be scrolled along with the content and will appear as part of the background.
override func viewDidLoad() {
super.viewDidLoad()
let topView = UIView(frame: CGRect(x: 0, y: -collectionView!.bounds.height,
width: collectionView!.bounds.width, height: collectionView!.bounds.height))
topView.backgroundColor = .blackColor()
collectionView!.addSubview(topView)
}
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