检测 UISlider 何时开始和结束拖动

Detect when UISlider begins and ends dragging

在 Xamarin iOS 中,如何检测 UISlider 何时开始拖动和结束拖动?我想对每个事件采取某些类型的操作,但我不确定如何接收这些通知。我查看了 ValueChanged 事件,但只有当值发生变化时才会触发此事件。

试试 UIControl 的 Touch Event:

public override void ViewDidLoad ()
{
    base.ViewDidLoad ();
    // Perform any additional setup after loading the view, typically from a nib.

    UISlider slider = new UISlider();
    this.Add(slider);

    slider.TouchDragEnter += (o, s) => {
        Console.WriteLine("slider touched");
    };

    slider.TouchDragExit += (o, s) => {
        Console.WriteLine("touch exit");
    };

    slider.TouchUpInside += (o, s) => {
        Console.WriteLine("button touched");
    };

    slider.TouchUpOutside += (o, s) => {
        Console.WriteLine("touch exit");
    };
}