UIWindow animation

I currently use a custom UIWindow to display a custom alert view to make it look Apple style. When I remove it, it doesn't fade automatically, sk I decided to use a UIView animation and change the alpha to 0 then remove it but that still didn't do the trick. Would you guys know what to do?

Answers


For the faded background window used by my own custom AlertView class (similar to what it sounds like you are doing) I made a custom UIWindow and overrode makeKeyAndVisible, but you can also do this outside context of the class:

- (void)makeKeyAndVisible
{
    self.backgroundColor = [UIColor clearColor];
    self.alpha = 0;

    [UIView beginAnimations: @"fade-in" context: nil];

    [super makeKeyAndVisible];

    self.alpha = 1;

    [UIView commitAnimations];
}

- (void)resignKeyWindow
{
    self.alpha = 1;

    [UIView beginAnimations: @"fade-out" context: nil];

    [super resignKeyWindow];

    self.alpha = 0;

    [UIView commitAnimations];
}

Try this:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:2.0];
[UIView setAnimationBeginsFromCurrentState:YES];

greyWindow.alpha = 0;

[UIView commitAnimations];  

Need Your Help

arc4random() gives negative Number in iOS

ios objective-c arc4random

Sometime arc4random() gives negative number also in objective C.

Converting table from MyISAM to INNODB

mysql bugzilla mysql-error-1214

I am simply trying to convert a table from MyISAM to INNODB. This is for a bugzilla upgrade with testopia.