So I have this code to add some instructions to my app's gameView
:
UILabel *instructions = [[UILabel alloc] initWithFrame:CGRectMake(40, 40, self.gameView.frame.size.width, 100)];
[instructions setTextColor:[UIColor whiteColor]];
[instructions setText:@"Some Instructions"];
[self.gameView addSubview:instructions];
NSLog(@"About to animate!");
[UIView animateWithDuration:2.0
delay:2.0
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{ [instructions setAlpha:0.0];}
completion:^(BOOL fin) {NSLog(@"done");}];
In the console I can see the messages About to animate!
and done
but the UILabel is never visible, also the two messages appear simultaneously, not after a 4 second gap.
My understanding was that this animation would display the UILabel with its default alpha value for 2 seconds, and then fade the alpha value down to 0 over the next two seconds. I have similar animation code for UIImageViews in other places in my code.