For the faded background window used by my own AlertView class (similar to how it sounds like you do it), I created a UIWindow and overrode makeKeyAndVisible user interface, but you can also do this outside the 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]; }
Tomswift
source share