Check if user finished sliding on a continuous UISlider?

前端 未结 4 1606
渐次进展
渐次进展 2021-01-31 07:37

In my app, I have a couple of UISlider instances to change various values. The values are displayed right next to the slider, as well as rendered in a 3d space in another visibl

4条回答
  •  眼角桃花
    2021-01-31 08:26

    I just had to do this, so I looked up touch properties, and used the full IBAction header.

    This should be a viable alternative for people who want some extra control, though Jas's is definitely easier on the code side.

    - (IBAction)itemSlider:(UISlider *)itemSlider withEvent:(UIEvent*)e;
    {
        UITouch * touch = [e.allTouches anyObject];
    
        if( touch.phase != UITouchPhaseMoved && touch.phase != UITouchPhaseBegan)
        {
           //The user hasn't ended using the slider yet.
        }
    
    }
    

    :D

提交回复
热议问题