ana*_*ali 9

是的,您可以在加载应用程序后立即显示动画.

如果您希望动画"Default.png"以淡出例如加载应用程序时,请尝试以下操作:

AppNameAppDelegate.h中:

#import UIKit/UIKit.h

@interface AppNameAppDelegate : NSObject  {
    UIImageView *splashView;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;

- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context;

@end
Run Code Online (Sandbox Code Playgroud)

AppNameAppDelegate.m中:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    [self.window makeKeyAndVisible];

    splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0,0, 320, 480)];
    splashView.image = [UIImage imageNamed:@"Default.png"];
    [_window addSubview:splashView];
    [_window bringSubviewToFront:splashView];
    //Set your animation below
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationTransition:UIViewAnimationTransitionNone forView:_window cache:YES];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector (startupAnimationDone:finished:context:)];
    splashView.frame = CGRectMake(-60, -60, 440, 600); 
    splashView.alpha = 0.0; 
    [UIView commitAnimations];

    return YES;
}

- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {
    [splashView removeFromSuperview];
    [splashView release];
}
Run Code Online (Sandbox Code Playgroud)

我不确定这是你在找什么,但也许......