iphone - iOS检查uislider值是增加还是减少。
<p><p>如何检查 slider 值是增加还是减少?任何帮助将不胜感激。我知道我应该使用临时值,但除此之外别无他法。 </p></p>
<br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
<p><p><strong>测试代码:100% 有效</strong></p>
<p>.h</p>
<pre><code>float lastSlidedValue;
-(IBAction)sliderMoving:(id)sender;
-(IBAction)sliderValueDidChanged:(id)sender;
</code></pre>
<p>.m</p>
<pre><code>-(IBAction)sliderValueDidChanged:(id)sender{//UIControlEventTouchUpInside connected method
UISlider *sliderr=(UISlider*)sender;
lastSlideValue=sliderr.value;
}
-(IBAction)sliderMoving:(id)sender{//UIControlEventValueChanged connected method
UISlider *sliderr=(UISlider*)sender;
if (lastSlideValue < sliderr.value) {
NSLog(@"big");
}
else if (lastSlideValue == sliderr.value) {
NSLog(@"equal");
}
else {
NSLog(@"low");
}
}
</code></pre></p>
<p style="font-size: 20px;">关于iphone - iOS检查uislider值是增加还是减少。,我们在Stack Overflow上找到一个类似的问题:
<a href="https://stackoverflow.com/questions/7529064/" rel="noreferrer noopener nofollow" style="color: red;">
https://stackoverflow.com/questions/7529064/
</a>
</p>
页:
[1]