objective-c - 可点击的 UISlider
<p><p>我想让我的 UISlider 可点击 - 将点击时的值更改为“空白”,例如它设置为零,我单击 slider 的中间,它会“跳”到中间。有没有办法做到这一点?</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我想提出类似于 jrtc27 的东西,但没有子类化:添加 <a href="https://developer.apple.com/library/ios/#documentation/uikit/reference/UIGestureRecognizer_Class/Reference/Reference.html" rel="noreferrer noopener nofollow"><code>UI(Tap)GestureRecognizer</code></a>到 slider 。</p>
<pre><code>UISlider *slider = [[ init] autorelease];
//configure slider
UITapGestureRecognizer *tapGestureRecognizer = [[ initWithTarget:self action:@selector(sliderTapped:)] autorelease];
;
- (void)sliderTapped:(UIGestureRecognizer *)gestureRecognizer {
UISlider *slider = (UISlider *) gestureRecognizer.view;
//setValue
}
</code></pre></p>
<p style="font-size: 20px;">关于objective-c - 可点击的 UISlider,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/10249510/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/10249510/
</a>
</p>
页:
[1]