SegmentedProgressBar icon indicating copy to clipboard operation
SegmentedProgressBar copied to clipboard

Gesture/taps : an enhancement

Open hcrgithub opened this issue 7 years ago • 2 comments

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

hcrgithub avatar Oct 12 '17 03:10 hcrgithub

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()
        }
    }
}

praveen4D2 avatar Nov 19 '19 11:11 praveen4D2

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.

bstillitano avatar Dec 22 '19 13:12 bstillitano