ZacharyKhan / ZKCarousel

A simple carousel implementation written in Swift
MIT License
289 stars 57 forks source link

Page number indicator fixed 3 items #10

Closed jlorencelim closed 6 years ago

jlorencelim commented 6 years ago

page number indicator has fixed 3 items even though the number of slides is not 3.

ZacharyKhan commented 6 years ago

Can you post the code snippet so I can see how you are adding carousel items to the carousel?

jlorencelim commented 6 years ago
@IBOutlet weak var imageCarousel: ZKCarousel! = ZKCarousel() {
        didSet {
            for productImage in self.product.images {
                Alamofire.request(productImage).responseImage { response in
                    if let image = response.result.value {
                        let slide = ZKCarouselSlide(image: image, title: "", description: "")
                        self.imageCarousel.slides.append(slide)
                    }
                }
            }
        }
    }
ZacharyKhan commented 6 years ago

Did you find a fix for this? I can't find any issues on my end.

ZacharyKhan commented 6 years ago

Closing due to inactivity. If it persists please open another issue.

mahi008 commented 6 years ago

I don't know if it helps but I managed to solve this by doing

    public var slides : [ZKCarouselSlide] = [] {
         didSet {
            self.collectionView.reloadData()
            pageControl.numberOfPages = slides.count
        }
    }