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
精彩评论