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

fix to when valueStepper is in a tableViewCell, autorepeat = true, and press on +/- after scrolling #14

Merged
merged 2 commits into from Jan 27, 2017

Conversation

skibadawid
Copy link
Contributor

@skibadawid skibadawid commented Jan 27, 2017

fix to #13 (a noob here so do I need to create an issue first and then do a PR?)

this part of code fixes issue where incrementing/decrementing is in infinite loop and when pressed + or - stops the it, attached a gif. also removes redundant continuousTimer?.invalidate() calls that can be replaced with continuousTimer = nil

private var continuousTimer: Timer? {
    didSet {
        if let timer = oldValue {
            timer.invalidate()
        }
    }
}

bug_semi_fix

Adding an event action .touchCancel fixed the issue with infinite increment/decrement. choose to add it to decrease()/increate selector so its responsive to user interaction, but could be attached to the stopContinuous of increase and decrease button. [around line 140]

decreaseButton.addTarget(self, action: #selector(decrease(_:)), for: [.touchUpInside, .touchCancel])
increaseButton.addTarget(self, action: #selector(increase(_:)), for: [.touchUpInside, .touchCancel])

skibadawid and others added 2 commits January 26, 2017 23:46
and when the tableview is scrolling, press on +/- caused infinite
decrease/increase (at event action .touchCancel)
@BalestraPatrick BalestraPatrick merged commit 88a523a into BalestraPatrick:master Jan 27, 2017
@BalestraPatrick
Copy link
Owner

This is great @skibadawid! If you find a bug and create a PR for it, no need to create a issue but this time it was nice because you added the GIF so I could see the bug visually. I never tested ValueStepper in a UITableView so I am happy you are fixing these edge cases. Thanks a lot!

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

Successfully merging this pull request may close these issues.

None yet

2 participants