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

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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容