Hi everybody,
I'm still trying to implement a simple animation effect for my application. It consists of a flashing effect that should look pretty similar to the one we get when we take a snapshot of the screen on the iPhone or iPod touch.
I made a NIB with a UIView where its alpha is set to 0.3 of a specific color. Then, I created a new UIViewController Class called: FlashingViewController. Then, In the NIB, I made the Class set to this new FlashingViewController.
Now, In the view controller, in the viewWillAppear, here is the code:
-(void)viewWillAppear:(bool)animated
{
float alphaValue = 0.3f;
[UIView beginAnimations:@"show" context:NULL];
[UIView setAnimationDuration:0.3f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationBeginsFromCurrentState:YES];
[UIView setAnimationDelegate:self];
do
{
self.view.alpha = alphaValue;
alphaValue = alphaValue + 0.1f;
}
while (alphaValue <>
do
{
self.view.alpha = alphaValue;
alphaValue = alphaValue - 0.1f;
}
while (alphaValue > 0.0f);
[UIView commitAnimations];
[self dismissModalViewControllerAnimated:NO];
}
Finally, I present this UIViewController with this line:
[self presentModalViewController:aFlashViewViewController animated:NO];
So, I get the view, no animation, no flashing effect whatsoever... nothing. Also, the UIView don't dismiss itself!
Ouch, please help me !