Animated Splash Screen in iPhone

前端 未结 7 1780

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 17:04

    You can use sequence of images, here is code :

    for(NSInteger i=1;i<=totalImages;i++){
            NSString *strImage = [NSString stringWithFormat:@"Activity_%d",i];
            UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:strImage ofType:@"png"]];
            [imageArray addObject:image];
        }
        splashImageView.animationImages = imageArray;
        splashImageView.animationDuration = 0.8;
    

    and just call startAnimation and endAnimation method of UIImageView.

    OR

    Its very simple...I had used it in to begin my app with splashView.Hope it vil help you.... In AppDelegate.m:

    application didFinishLaunchingWithOptions:

    UIImage* image=[UIImage imageNamed:@"splash.jpg"];
    splashView=[[UIImageView alloc]initWithImage:image];
    [window addSubview:splashView];
    [window bringSubviewToFront:splashView];
    [self performSelector:@selector(removeSplash) withObject:self afterDelay:2];
    [window makeKeyAndVisible];
    

    To remove splashView:

    -(void)removeSplash{
    
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:window cache:YES];
        [UIView setAnimationDuration:0.75];
        [UIView setAnimationDelegate:self];
        [splashView removeFromSuperview];
        [UIView commitAnimations];
        [window addSubview:viewController.view];
    }
    

提交回复
热议问题