0

I have a collection view and I want to add a image to the background but I want that the imagen change depending the section.

I`m changing the header and I can modify the header depending the section but I can“t make the same with the background of the section.

This is my background decoration:

class SectionBackground: UICollectionReusableView {
    
    let imageView = UIImageView()
    
    override init(frame: CGRect) {
        super.init(frame: frame)

        
        configure()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension SectionBackground {
    func configure() {
        
        imageView.image = UIImage(named: "categorias_cat_1_base")
        
        imageView.frame = self.bounds
        
        addSubview(imageView)

    }
}

I`m using the method 'viewForSupplementaryElementOfKind' but i can`t use it for the background I tried to check the kind but there isn`t any kind for the section background.

Victor
  • 9
  • 2

0 Answers0