Im trying to control a UIView's animation duration with a UISlider
. The animation works fine and runs as if the duration is set to 1.0, but it doesn't respond to the slider. I'm kinda new so any help is greatly appreciated.
@interface ViewController (){
float number;
}
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
[_slider setMinimumValue:0.5];
[_slider setMaximumValue:1.0];
[_slider setValue:0.5];
number = _label.text.floatValue;
_image.frame = 1
[UIView animateWithDuration:number delay:0.1f options:UIViewAnimationOptionCurveLinear | UIViewKeyframeAnimationOptionAutoreverse | UIViewKeyframeAnimationOptionRepeat animations:^{
_image.frame2;
}
completion:^(BOOL finished) {
_image.frame1;
}];
}
- (IBAction)sliderAction:(id)sender {
_label.text = [NSString stringWithFormat:@"%f", _slider.value];
}
@end