iPhone : How to detect the end of slider drag?

后端 未结 16 2614
不思量自难忘°
不思量自难忘° 2020-12-02 07:36

How to detect the event when the user has ended the drag of a slider pointer?

16条回答
  •  自闭症患者
    2020-12-02 08:35

    Try like this

    customSlider.minimumValue = 0.0;
        customSlider.maximumValue = 10.0;
    [customSlider addTarget:self action:@selector(changeSlider:) forControlEvents:UIControlEventValueChanged];
    
    
    -(void)changeSlider:(id)sender{
        UISlider *slider=(UISlider *)sender;
        float sliderValue=(float)(slider.value );
    NSLog(@"sliderValue = %f",sliderValue);
    }
    

提交回复
热议问题