设置和获取Slider值

时间:2014-04-24 04:07:48

标签: ios objective-c uislider

我声明像这样的滑块动作

         [self.slider addTarget:self.delegate action:@selector(sliderChanged:) forControlEvents:UIControlEventValueChanged];

现在,在委托中,我想要改变价值。

- (void)sliderChanged:(id)sender
{
UIView *senderView = [sender view]; 
NSLog(@"Slider Changed: %f", slider.value);

我无法得到它

1 个答案:

答案 0 :(得分:1)

尝试使用

- (void)sliderChanged:(UISlider *)sender
{

NSLog(@"Slider Changed: %f", sender.value);
}