【发布时间】:2015-03-12 06:10:19
【问题描述】:
我创建了一个 GIF,它基本上是雪粒飘落,并具有透明背景。因此,我可以在应用程序上的其他 PNG 和图像上流过雪。问题是应用程序加载并且 GIF 显示为全白。不知道为什么,因为我在制作时给了它透明度。如果我在 Xcode 中降低 alpha,我仍然看不到我的旧 PNG(通常的背景图像)。
这是在我的 ViewController.m 中
- (void)viewDidLoad
{
[super viewDidLoad];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"snow" ofType:@"gif"];
NSData *gif = [NSData dataWithContentsOfFile:filePath];
UIWebView *webViewBG = [[UIWebView alloc] initWithFrame:self.view.frame];
[webViewBG loadData:gif MIMEType:@"image/gif" textEncodingName:nil baseURL:nil];
webViewBG.userInteractionEnabled = NO;
[self.view addSubview:webViewBG];
UIView *filter = [[UIView alloc] initWithFrame:self.view.frame];
//filter.backgroundColor = [UIColor redColor];
filter.alpha = 0.5;
[self.view addSubview:filter];
【问题讨论】:
-
设置 webviews 背景清除颜色?也不确定webview的内容是否透明......你可以用动画图像制作UIImageViews afaik,你必须给它一个图像数组虽然我认为不是gif
标签: ios objective-c background gif zposition