GMStepper
GMStepper copied to clipboard
stepper in tableViewCell
let qytStepper = cell.viewWithTag(97) as! GMStepper
qytStepper.labelFont = UIFont.systemFontOfSize(15.0)
qytStepper.minimumValue = 0
qytStepper.layer.borderWidth = 1.0
qytStepper.layer.borderColor = UIColor.lightGrayColor().CGColor
qytStepper.tag = indexPath.row
qytStepper.addTarget(self, action: "stepperValueChanged:", forControlEvents: .ValueChanged)
not working
Hi @longxianlin, can you elaborate on what is not working?
I'm also having an issue with GMStepper in a tableviewcell.
I don't have the issue quite pinned down yet, but occasionally when quickly scrolling through the list, I'll see this issue:
` @IBAction func onStepperValueChanged(_ sender: GMStepper) { print("stepper (sender.value)) // this line runs 2nd, value is 2 }
// MARK: Local Func
func setContent(quantity: Double) {
stepper.value = quantity
print("set content: \(stepper.value)") // this line runs 1st, value is 1
`
I am having the same issue. I have the stepper in 10 rows in a Uitableviewcell. If you start scrolling the addTarget method fires even though the button was not touched. I guess it is firing once the cell gets dequeued. Anyway to fix that behavior?
@kalmicka
cell.stepper.value = count
Setting value to stepper programmatically also fire .ValueChanged
event. Maybe you set value to stepper somewhere in cellForRowAt
Any solution to this?