可点击的UISlider [英] Clickable UISlider
本文介绍了可点击的UISlider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想让我的UISlider可点击 - 将点击值更改为空格,例如它被设置为零,我点击滑块的中间,它将跳到中间。有什么方法可以做到这一点吗?
I'd like to make my UISlider clickable - to change the value on click to "blank space", e.g. It's set to zero, I click in the middle of the slider and it will "jump" to the middle. Is there any way how to do this?
推荐答案
我想提出类似于jrtc27的东西,但是没有子类化:添加一个< a href =https://developer.apple.com/library/ios/#documentation/uikit/reference/UIGestureRecognizer_Class/Reference/Reference.html\"rel =nofollow> UI(点击)GestureRecognizer
到滑块。
I want to propose something similar as jrtc27, but without subclassing: add a UI(Tap)GestureRecognizer
to the slider.
UISlider *slider = [[[UISlider alloc] init] autorelease];
//configure slider
UITapGestureRecognizer *tapGestureRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sliderTapped:)] autorelease];
[slider addGestureRecognizer:tapGestureRecognizer];
- (void)sliderTapped:(UIGestureRecognizer *)gestureRecognizer {
UISlider *slider = (UISlider *) gestureRecognizer.view;
//setValue
}
这篇关于可点击的UISlider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文