ios - 如何获得范围 slider 中的最终值?
<p><p>我正在使用 TT 范围 slider (双 slider )在我的应用程序中过滤价格,一切正常,但是当我的最终价格是一些(例如 20)而没有选择 slider 时,我点击应用按钮最终价格是不来,如果有任何答案, slider 选项将变为 0 值,将不胜感激。提前致谢。
我的代码</p>
<pre><code>float price = ;
NSLog(@"%f",price);
if ([.Apply isEqualToString:@"Apply"]) {
float minimum = [[valueForKey:@"filtermin"] floatValue];
float maxmum = [[valueForKey:@"filtermax"] floatValue];
minValue = [valueForKey:@"filtermin"];
maxValue = [valueForKey:@"filtermax"];
//standard range slider
self.rangeSlider.delegate = self;
self.rangeSlider.minValue = 0;
self.rangeSlider.maxValue = price;
self.rangeSlider.step = price;
self.rangeSlider.selectedMinimum = minimum;
self.rangeSlider.selectedMaximum = maxmum;
NSNumberFormatter *customFormatter = [ init];
customFormatter.positivePrefix = @"£";
self.rangeSlider.numberFormatterOverride = customFormatter;
self.rangeSlider.tintColorBetweenHandles = ;
}
else
{
float price = ;
//standard rsnge slider
self.rangeSlider.delegate = self;
self.rangeSlider.minValue = 0;
self.rangeSlider.maxValue = price;
self.rangeSlider.selectedMinimum = 0;
self.rangeSlider.selectedMaximum = price;
NSNumberFormatter *customFormatter = [ init];
customFormatter.positivePrefix = @"£";
self.rangeSlider.numberFormatterOverride = customFormatter;
self.rangeSlider.tintColorBetweenHandles = ;
}
</code></pre>
<p>当应用按钮点击时</p>
<pre><code> .PriceRange = @"PriceRange";
[setValue:minValue forKey:@"filtermin"];
[setValue:maxValue forKey:@"filtermax"];
[synchronize];
NSLog(@"%@",maxValue);
;
</code></pre></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p>添加此委托(delegate)方法,您将使用它获取最小和最大 slider 值。</p>
<pre><code> -(void)rangeSlider:(TTRangeSlider *)sender didChangeSelectedMinimumValue:(float)selectedMinimum andMaximumValue:(float)selectedMaximum{
NSLog(@" Min Value: %.0f Max Value: %.0f", selectedMinimum, selectedMaximum);
[setValue:selectedMinimum forKey:@"filtermin"];
[setValue:selectedMaximum forKey:@"filtermax"];
}
</code></pre></p>
<p style="font-size: 20px;">关于ios - 如何获得范围 slider 中的最终值?,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/53589611/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/53589611/
</a>
</p>
页:
[1]