I have created a program and found an error that i cannot seem to work out.
I have stripped the problem out to recreate in a brand new project but it still re occurs.
The problem is when i press the BUTTON the image changes but at a much faster speed than the speed set up in NSTIMER but only the first time the button is pressed.
If i carry on pressing the button the image changes at the speed i require.
IT ONLY HAPPENS ON THE FIRST TIME ROUND AND I AM USING A TOUCH DOWN EVENT ( ALTHOUGH I HAVE TRIED TOUCH UP INSIDE )
This only happens the first time and is extremely important that the first time is the same timing as the rest.
I am aware of various discussions as to the accuracy of NSTIMER anyway , but i dont think it is relevant to my question
here is my .h
- (IBAction)slap:(id)sender {
NSString *imagechange4 = [NSString stringWithFormat:@"onehandedplayer2.png"];
//player2 is an UIButton IBOutlet
[player2 setImage:[UIImage imageNamed:imagechange4]];
[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(handsback1) userInfo:nil repeats:NO];
}
-(void)handsback1 {
NSString *imagechange3= [NSString stringWithFormat:@"hands rotated.png"];
[player2 setImage:[UIImage imageNamed:imagechange3]];
}