iPhone / iPad:动画闪屏? [英] iPhone/iPad: animated splash screen?

查看:108
本文介绍了iPhone / iPad:动画闪屏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个动画徽标,作为我的iphone / ipad应用程序的启动画面。

I want to create an animated logo that serves as the splash screen for my iphone/ipad app.

我正在考虑显示default.png,然后转换为.mp4(.mp4的第一帧与default.png匹配),播放3秒电影,淡出并加载我的应用程序。

I'm thinking of showing the default.png, which then transitions to an .mp4 (where the first frame of the .mp4 matches the default.png), plays a 3 second movie, fades out, and loads my application.

有没有人有这方面的经验?我的想法(使用.mp4)是实现这一目标的最佳方式吗?另外,苹果公司很酷吗?

Does anyone have any experience with this? And is my idea (using .mp4) the best way to achieve this? Also, is Apple "cool" with this?

提前致谢。

推荐答案

是的,你绝对可以做到这一点,是的,Apple很酷。

Yes you can absolutely do this and yes Apple is cool with it.

你可以使用MPMoviePlayerController,将它放在带有启动图像的UIImageView下,当电影已加载并准备好去除UIImageView并播放电影。

You could use MPMoviePlayerController, place it under a UIImageView with the launch image and when the movie is loaded and ready to go remove the UIImageView and play the movie.

但考虑到MPMoviePlayerController有时很挑剔,你需要仔细考虑时间。这是一个可以作为起点的片段:

But given the sometimes finicky nature of MPMoviePlayerController you need to time things carefully. Here's a snippet you can use as a starting point:

-(void)setupMovie {
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieComplete:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification object:self.playerView];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playMovie:)
                                                 name:MPMoviePlayerLoadStateDidChangeNotification object:self.playerView];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(showMovie:)
                                                 name:MPMoviePlayerPlaybackStateDidChangeNotification object:self.playerView];

    [self.playerView setContentURL:[[NSBundle mainBundle] URLForResource:@"movie" withExtension:@"mov"]];
    [self.playerView prepareToPlay];
}


-(void)playMovie:(NSNotification *)notification {
    if (self.playerView.loadState == MPMovieLoadStatePlayable | MPMovieLoadStatePlaythroughOK) {
        [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerLoadStateDidChangeNotification object:notification.object];
        [self.playerView play];     
    }
}

-(void)showMovie:(NSNotification *)notification {
    if (self.playerView.playbackState == 1) {
        [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackStateDidChangeNotification object:notification.object];
        // should update this to new UIView anim methods
        [UIView beginAnimations:nil context:nil];
        [UIView setAnimationDuration:.2];
        self.splashScreen.alpha = 0;
        [UIView commitAnimations];      
    }
}

这篇关于iPhone / iPad:动画闪屏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆