平时launch页面有动态图是gif动画分解成一帧一帧的静态图,现在可以用如下方法启用动画。
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"railway" ofType:@"gif"];
NSData *gif = [NSData dataWithContentsOfFile:filePath];
self.webViewBG = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].bounds];
[_webViewBG loadData:gif MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];
_webViewBG.userInteractionEnabled = NO;
[self.window addSubview:_webViewBG];
[self performSelector:@selector(setAnimation:) withObject:_webViewBG afterDelay:8];
-(void)setAnimation:(UIWebView *)nowView
{
[nowView removeFromSuperview];
}
此处代码在AppDelegate,第一个方法中填写。填充的图片最好大于6plus的尺寸,这样可以在各个屏幕显示了!