GMStepper icon indicating copy to clipboard operation
GMStepper copied to clipboard

stepper in tableViewCell

Open longxianlin opened this issue 8 years ago • 5 comments

    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

longxianlin avatar Oct 30 '15 02:10 longxianlin

Hi @longxianlin, can you elaborate on what is not working?

gmertk avatar Nov 01 '15 14:11 gmertk

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

`

mihaibulic avatar Nov 20 '16 09:11 mihaibulic

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 avatar Apr 26 '17 21:04 kalmicka

@kalmicka cell.stepper.value = count Setting value to stepper programmatically also fire .ValueChanged event. Maybe you set value to stepper somewhere in cellForRowAt

Elshad avatar Jun 05 '17 21:06 Elshad

Any solution to this?

Dave181295 avatar Oct 20 '21 15:10 Dave181295