【问题标题】:iPhone/iPad: animated splash screen?iPhone/iPad:动画闪屏?
【发布时间】:2011-05-30 03:54:31
【问题描述】:

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

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

有人有这方面的经验吗?我的想法(使用.mp4)是实现这一目标的最佳方式吗?另外,Apple 在这方面“很酷”吗?

提前致谢。

【问题讨论】:

  • 我建议重新考虑这个计划,因为一个 3 秒的动画徽标(在等待的顶部已经出现在静态启动屏幕上)可能会导致一半的人在你的应用程序完成之前退出正在加载。
  • 无论如何我都会暂停 2-3 秒(并且已经在多个应用程序中成功地这样做了),因此我假设用户更喜欢美学动画,而不是静态屏幕。
  • 许多应用使用类似的动画/电影。我觉得你很好。

标签: iphone objective-c ipad


【解决方案1】:

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

您可以使用 MPMoviePlayerController,将其放在带有启动图像的 UIImageView 下,当影片加载完毕并准备好移除 UIImageView 并播放影片时。

但是考虑到 MPMoviePlayerController 有时很挑剔的性质,您需要谨慎地安排时间。这是一个可以用作起点的 sn-p:

-(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];      
    }
}

【讨论】:

    【解决方案2】:

    我认为像这样的教程会有所帮助:http://www.youtube.com/watch?v=wCsumlHiEc0&feature=channel_video_title

    【讨论】:

      【解决方案3】:

      响应 UIApplicationDidFinishLaunchingNotification。我同意@jhocking 的观点,您应该考虑这样的等待是否是最好的用户体验,但如果是,这是一项非常简单的任务。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2021-10-17
        • 1970-01-01
        • 1970-01-01
        • 2019-12-26
        • 2022-01-26
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多