SWIFT Scrollview in a view to select multiple horizontal images

0

I hope someone helps me, I have a scrollview to select an image, and as it is common to pass the selected image to the view and the others are not seen, I would like to have the collection of images in the same view and be able to select one but that they go traveling and in the center that is going to be selected, these images are small, I have it as in the first photo, but I want them to look like in the second, I already tried to change the size of the scrollview but it does rare things and I do not select any image and stays in it and runs through all the images .. in short, I want it to look like the second image, the first I'm doing well, I really do not know what is wrong for to achieve it like in the second, according to me it is only to change the size of the scrollview ... this is the photo:

this is the code I have:

private var instrumentsImagesArray = UIImage

    private func carousell() {
    instrumentsImagesArray = [#imageLiteral(resourceName: "keyboard2x"), #imageLiteral(resourceName: "guitar"), #imageLiteral(resourceName: "drumm"), #imageLiteral(resourceName: "mic"), #imageLiteral(resourceName: "tune")]

    instrumentLabelGain = []
    for i in 0..<instrumentsImagesArray.count {
        let instrumentsImageView = UIImageView()
        instrumentsImageView.image = instrumentsImagesArray[i]
        let positionX = self.view.frame.width * CGFloat(i)
        instrumentsImageView.contentMode =  .scaleAspectFit
        instrumentsImageView.frame = CGRect(x: positionX, y: 15, width: self.scrollImageInstrument.frame.width,
                                                                height: self.scrollImageInstrument.frame.height - 25)

        levelImageVolumeLabel.frame = CGRect(x: self.scrollImageInstrument.frame.midX + 10,
                                             y: self.scrollImageInstrument.frame.minY - 87, width: 32,
                                             height: 32)

        scrollImageInstrument.contentSize.width = scrollImageInstrument.frame.width * CGFloat(i + 1)
        scrollImageInstrument.addSubview(levelImageVolumeLabel)
        scrollImageInstrument.addSubview(instrumentsImageView)
    }
    
asked by Yan Cervantes 07.11.2017 в 16:55
source

0 answers