Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gesture/taps : an enhancement #8

Open
hcrgithub opened this issue Oct 12, 2017 · 2 comments
Open

Gesture/taps : an enhancement #8

hcrgithub opened this issue Oct 12, 2017 · 2 comments

Comments

@hcrgithub
Copy link

hcrgithub commented Oct 12, 2017

Hi, this is an enhancement suggestion for this library.

We can have tap to each of the segment to move to that part as well as have tap gesture on the left edge and right edge of the screen to move between segments.

In addition to this, when doing long press on screen, the transition can pause and when finger is lifted, the transition can resume.

Inspired from status option in whats app.

Regards
Hooda

@praveen4D2
Copy link

Hi,

I have coded like below its working fine for me.

/// Adding long-press gesture

    let longGesture = UILongPressGestureRecognizer(target: self, action: #selector(self.longTap(_:)))
    longGesture.minimumPressDuration = 0.15
    statusImageView.isUserInteractionEnabled = true
    statusImageView.addGestureRecognizer(longGesture)
    
    let longGestureVideo = UILongPressGestureRecognizer(target: self, action: #selector(self.longTap(_:)))
    longGestureVideo.minimumPressDuration = 0.15
    
    videoView.isUserInteractionEnabled = true

    videoView.addGestureRecognizer(longGestureVideo)

/// on long tap

@objc func longTap(_ sender: UITapGestureRecognizer){

    if sender.state == .ended {

        SPB.isPaused = false
        if storyDict["storyType"] as! String == "video"
        {
            self.player.play()
        }
    }
    else if sender.state == .began {
        
        SPB.isPaused = true
        if storyDict["storyType"] as! String == "video"
        {
            self.player.pause()
        }
    }
}

@bstillitano
Copy link

This would not be a valid requirement on this library, the library provides access to pausing and resuming functions that would be triggered by a gesture on your ViewController.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants