xcodeswiftimage-processinggpuimageuievent

GPUImage does not update when MotionShake detected


I have a fuction, which after a shake, resets all sliders to their defaults and calls -proccesImage after the slider's value has been changed. The problem is that each of the sliders do, in fact, get reset to the default positions but GPUImage does not update the view.

override func motionEnded(motion: UIEventSubtype, withEvent event: UIEvent?)
{
    if(event?subtype) == UIEventSubtype.MotionShake{
        for slider in sliders!
        {
            slider.value = myDefault(slider.tag);
            sliderValueChanged(slider)
        }
    } 
}

@IBAction func sliderValueChanged(sender: UISlider)
{

    switch sender.tag{
        case 1:
            filter.temperature = CGFloat(sender.value)

        case 2:
            dliter2.exposure = CGFloat(sender.value)
        case 3:
            //more cases..
        default:print("...")

    }
    gpuimage?.processImage(); // I know for a fact that this gets called, but doesn't update the view :(
}

Note that I also have an identical functionality attached to UITap gesture. When a user double taps a slider, it goes back to its default value and updates right away. Code below works perfectly fine.

func resetSlider(sender: UITapGestureRecognizer)
{
        let tag = (sender.view?.tag)!;
        sliders![tag].value = myDefault(tag)
        sliderValueChanged(sliders![tag]);
}

Solution

  • So I haven't found a reason why it wasn't updating. But I solved the issue by removing all targets and calling viewWillAppear() after that, so that it would re-add the targets just as if it was a brand new image.