When I press my button, nothing happens. How can I fix this?
And the integer x is declared in the .h file. Edit: the button defines a value for x , and as you see in the code , x is added to the rotation duration. When I press the button , the duration doesn't increase. Here's my code:
#import "ViewController.h"
#import <QuartzCore/QuartzCore.h>
@interface ViewController ()
@end
@implementation ViewController
- (IBAction)button1:(UIButton *)sender {x=10;}
- (IBAction)button2:(UIButton *)sender {x=3;
}
- (void)viewDidLoad
{ CABasicAnimation *fullRotation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
fullRotation.fromValue = [NSNumber numberWithFloat:0];
fullRotation.toValue = [NSNumber numberWithFloat:((360*M_PI)/180)];
fullRotation.duration = 10+x;
fullRotation.repeatCount= 1000;
[[_stick layer] addAnimation:fullRotation forKey:@"60"];
[super viewDidLoad];
}
// Do any additional setup after loading the view, typically from a nib.
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end