本文介绍了可点击的UISlider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我想让我的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的东西,但是没有子类化:添加一个 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 sliderUITapGestureRecognizer *tapGestureRecognizer = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(sliderTapped:)] autorelease];[slider addGestureRecognizer:tapGestureRecognizer];- (void)sliderTapped:(UIGestureRecognizer *)gestureRecognizer { UISlider *slider = (UISlider *) gestureRecognizer.view; //setValue} 这篇关于可点击的UISlider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-11 12:10