开发者

UISlider highlited property for showing the value.

开发者 https://www.devze.com 2023-03-27 05:28 出处:网络
i have IBOutlet uislid开发者_开发问答er. i want it to show the value of slider when the user presses the slider and change the value of it when the user take his hand off the slider i want it to disap

i have IBOutlet uislid开发者_开发问答er. i want it to show the value of slider when the user presses the slider and change the value of it when the user take his hand off the slider i want it to disapper. So when the user touches to change the value of slider the label shows the value and when the user take his finger of the slider the label automaticly disapper.

My code is:

-(IBAction)sliderSlide:(UISlider *)aSlider {


    float f=slider.value;
    NSString *show=[NSString stringWithFormat:@"%.2f %%",f];
    label2.text=show;


}

i know i need to use slider.highlited=YES; but where and how can i turn it back to hidden?


- (IBAction)touchEndedAction
{
   self.label2.hidden = YES;
}

set the IBAction to the sliders UIControlEventEditingDidEnd or UIControlEventTouchCancel

try it out.


UIControlEventEditingDidEnd didn't work for me, but UIControlEventTouchDown works

0

精彩评论

暂无评论...
验证码 换一张
取 消