Horhe Garcia
Horhe Garcia

Reputation: 902

Get Slider value action when editing finished Xcode iOS

I've tried "editing end" and "editing drag exit" but it doesn't work.

This works:

 - (IBAction)ValueChanged:(id)sender {
    int value1 = (int)(Slider1.value * 255);

    Label1.text = [[NSString alloc] initWithFormat: @"%i", value1 ];
}


- (IBAction)TouchDown:(id)sender forEvent:(UIEvent *)event {
    int value2 = (int)(Slider1.value * 255);

    Label1.text = [[NSString alloc] initWithFormat: @"%i", value2 ];

}

Nothing changes with it:

- (IBAction)TouchCancel:(id)sender forEvent:(UIEvent *)event {
    int value2 = (int)(Slider1.value * 255);

    Label1.text = [[NSString alloc] initWithFormat: @"%i", value2 ];
}


- (IBAction)EditingEnd:(id)sender {
    int value2 = (int)(Slider1.value * 255);

    Label1.text = [[NSString alloc] initWithFormat: @"%i", value2 ];
}

Upvotes: 0

Views: 4713

Answers (1)

Kevin Low
Kevin Low

Reputation: 2682

The default event that UISliders use is UIControlEventValueChanged.

After that, the method should look something like this:

- (IBAction)sliderAction:(id)sender {
// fun code
}

Upvotes: 1

Related Questions