如何检查 slider 值是增加还是减少?任何帮助将不胜感激。我知道我应该使用临时值,但除此之外别无他法。
测试代码:100% 有效
.h
float lastSlidedValue;
-(IBAction)sliderMovingid)sender;
-(IBAction)sliderValueDidChangedid)sender;
.m
-(IBAction)sliderValueDidChangedid)sender{//UIControlEventTouchUpInside connected method
UISlider *sliderr=(UISlider*)sender;
lastSlideValue=sliderr.value;
}
-(IBAction)sliderMovingid)sender{//UIControlEventValueChanged connected method
UISlider *sliderr=(UISlider*)sender;
if (lastSlideValue < sliderr.value) {
NSLog(@"big");
}
else if (lastSlideValue == sliderr.value) {
NSLog(@"equal");
}
else {
NSLog(@"low");
}
}
关于iphone - iOS检查uislider值是增加还是减少。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7529064/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |