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

你可能感兴趣的:(iOSAPP第一次安装时的引导动画 GIF 与视频)