Animated Splash Screen in iPhone

前端 未结 7 1783

I need to implement animated splash screen to the iPhone application. I have seen skype application where same thing is already implemented.

Can anyone has idea how can

7条回答
  •  悲&欢浪女
    2021-02-03 16:49

    yes simple in AppDelegate class first defile imageview like bellow..

    @interface AppDelegate : UIResponder 
    {
        UIImageView *splashView;
    }
    

    and in .m file...

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
        if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) 
        {
            splashView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
            splashView.image = [UIImage imageNamed:@"Default"];
            [self.window addSubview:splashView];
    
            [self performSelector:@selector(loadViewIphone) withObject:nil afterDelay:2.0];
        } 
        [self.window makeKeyAndVisible];
        return YES;
    }
    
    -(void)loadViewIphone 
    {
        [splashView removeFromSuperview];
        self.window.rootViewController = self.tabBarController;
        [self.window makeKeyAndVisible];
        CATransition *animation = [CATransition animation];
        [animation setDelegate:self];   
        [animation setType:kCATransitionFade];
        [animation setDuration:0.5];
        [animation setTimingFunction:[CAMediaTimingFunction functionWithName:
                                      kCAMediaTimingFunctionEaseInEaseOut]];
        [[self.window layer] addAnimation:animation forKey:@"transitionViewAnimation"];
    }
    

    i hope this help you..

    :)

提交回复
热议问题