有一个NSSlider,其代码如下
- (IBAction)sliderChanged:(id)sender {
NSSlider *slider = sender;
NSInteger value = slider.integerValue;
NSLog(@"%ld",value);
}
因为我设置了slider.continuous = YES;
,所以NSLog
会实时打印,这是正确的,我需要添加更多内容,除了上面的功能,我想在更改完成后获取值, 有任何想法吗?非常感谢。
答案 0 :(得分:-1)
UISlider
是UIControl
的子类,您可以为事件UIControlEventTouchUpInside
添加目标及其动作。 xib 1
- (IBAction)sliderChanged:(id)sender{
UISlider *slider = sender;
NSLog(@"sliderChanged Value = %ld",(long)slider.value);
}
- (IBAction)sliderFinished:(id)sender{
UISlider *slider = sender;
NSLog(@"sliderFinished Value = %ld",(long)slider.value);
}