美文网首页iOS进阶之路
iOSAPP第一次安装时的引导动画 GIF 与视频

iOSAPP第一次安装时的引导动画 GIF 与视频

作者: 幻影道哥 | 来源:发表于2017-05-12 11:32 被阅读6次

    APP第一次安装时的引导动画我用的是  GIF 与视频来达到炫酷的效果的.

    1.用MPMoviePlayerController播放视频.

    self.player = [[MPMoviePlayerController alloc] initWithContentURL:_movieURL];

    [self.view addSubview:self.player.view];

    self.player.shouldAutoplay = YES;

    [self.player setControlStyle:MPMovieControlStyleNone];

    self.player.repeatMode = MPMovieRepeatModeOne;

    [self.player.view setFrame:self.view.bounds];

    self.player.view.alpha = 0;

    [UIView animateWithDuration:3 animations:^{

    self.player.view.alpha = 1;

    [self.player prepareToPlay];

    }];

    2.用UIWebView播放gif图片 如下.

    NSString *path = [[NSBundle mainBundle] pathForResource:@"111" ofType:@"gif"];

    NSData *gifData = [NSData dataWithContentsOfFile:path];

    UIWebView *webView = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];

    webView.scalesPageToFit = YES;

    [webView loadData:gifData MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];

    webView.backgroundColor = [UIColor clearColor];

    webView.opaque = NO;

    [self.view addSubview:webView];

    相关文章

      网友评论

        本文标题:iOSAPP第一次安装时的引导动画 GIF 与视频

        本文链接:https://www.haomeiwen.com/subject/gkyztxtx.html