zvonicek / ImageSlideshow

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

Swipe Gesture #398

Open coder123-star opened 3 years ago

coder123-star commented 3 years ago

When I try to add a swipe gesture to the fullscreen view nothing happens. I am wondering what the top view is because I have tried adding the gesture to the FullScreenSlideshowViewController.

Tisobyn commented 3 years ago

Also can you add dismiss fullscreenviewcontroller by swiping (from bottom to top) and (from top to bottom)

Hardip-Unikwork commented 2 years ago

You can add swipe to dismiss feature this way add this in your project

extension FullScreenSlideshowViewController {

    func addSwipeDownGesture() {
        DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
            let swipeDownGesture = UISwipeGestureRecognizer(target: self, action: #selector(self.swipeDownFullScreenControllerGestureRecognizer))
            swipeDownGesture.direction = .down
            self.view.addGestureRecognizer(swipeDownGesture)
        }
    }

    @objc func swipeDownFullScreenControllerGestureRecognizer() {
        self.dismiss(animated: true, completion: nil)
    }

}