I'm working on a new app and I wanted to do a tap to continue opening screen. What I'm doing is scaling a UILabel (created in IB) up and down like this:
note:self.labelShouldScaleUp is a BOOL.
-(void)animateLabel{
if(self.labelShouldScaleUp){
[UIView animateWithDuration:1 animations:^(void){
self.clickToContinueLabel.transform=CGAffineTransformScale(self.clickToContinueLabel.transform, 2, 2);
} completion:^(BOOL finished){
self.labelShouldScaleUp=NO;
}];
}
if(!self.labelShouldScaleUp){
[UIView animateWithDuration:1 animations:^(void){
self.clickToContinueLabel.transform=CGAffineTransformScale(self.clickToContinueLabel.transform, 0.5, 0.5);
} completion:^(BOOL finished){
self.labelShouldScaleUp=YES;
}];
}
[self performSelector:@selector(animateLabel) withObject:nil afterDelay:1.05];
}
The code works, but when the label is done scaling every time, it jumps to the right or left and then scales the other way. I'm not sure why this is happening.
Thanks in advance for you help.