ios - 如何在双面 slider 中将 slider 设置为标记的动画
<p><p>我必须使用双面 slider 来获得最小值和最大值。</p>
<p>在最小值和最大值之间也有标记,如下图所示。</p>
<pre><code>|--------|-----------|---------|
10 20 30 40
</code></pre>
<p>当我在 10-20 之间拖动假设左 nob 时,如果值小于 15 则自动设置动画/移动到 10,但如果值大于 15 则它自动移动/设置为 20。</p>
<p>我不知道如何移动/动画它。</p>
<p>我正在使用REDRangeSlider项目作为引用。</p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>我已根据您的要求对代码进行了一些更改。请检查这个。</p>
<p>在分配初始化此控件时添加此方法。</p>
<pre><code>;//This is already added.
;//add this
</code></pre>
<p>实现该方法——拖拽结束时调用该方法。</p>
<pre><code>-(void)dragEnded:(id)sender
{
NSLog(@"called");
//Set your Conditions this is for testing.
if (self.rangeSlider.leftValue<15.0)
{
self.rangeSlider.leftValue = 10.0;
}
}
</code></pre>
<p>在REDRangeSlider 类中勾选这两个处理Pan Gesture 状态的方法,所以当你拖动end 时,方法会调用这个手势状态。那时调用这个你集成到你的主类中的 Action 。</p>
<pre><code>- (void)leftHandlePanEngadged:(UIGestureRecognizer *)gesture
{
else if (panGesture.state == UIGestureRecognizerStateCancelled ||
panGesture.state == UIGestureRecognizerStateEnded ||
panGesture.state == UIGestureRecognizerStateCancelled) {
self.leftHandle.highlighted = NO;
self.leftValue = ;
//Change below line For Left .
;
}
}
- (void)rightHandlePanEngadged:(UIGestureRecognizer *)gesture
{
UIPanGestureRecognizer *panGesture = (UIPanGestureRecognizer *)gesture;
//Other code ........
else if (panGesture.state == UIGestureRecognizerStateCancelled ||
panGesture.state == UIGestureRecognizerStateEnded ||
panGesture.state == UIGestureRecognizerStateCancelled) {
self.rightHandle.highlighted = NO;
self.rightValue = ;
//Change below line For right .
;
}
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何在双面 slider 中将 slider 设置为标记的动画,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/23290294/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/23290294/
</a>
</p>
页:
[1]