zvonicek / ImageSlideshow

Swift image slideshow with circular scrolling, timer and full screen viewer
MIT License
1.77k stars 475 forks source link

Is there a way to detect selection on each image and get its index ? #413

Open mhmdzaid opened 3 years ago

mhmdzaid commented 3 years ago

I need to perform action on clicking on each image , so I am asking if there is a way for doing this ? @zvonicek

stharajiv commented 3 years ago

you can implement didTap gesture and get the current page :

on viewDidLoad add the following code :

let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(ProductDetailsViewController.didTap))
        slideShow.addGestureRecognizer(gestureRecognizer)
@objc func didTap() {
// you can put your click action here for the images
let currentPage = slideShow.currentPage // you can get the current index for the image of slider
}

I need to perform action on clicking on each image , so I am asking if there is a way for doing this ? @zvonicek