How can I make this GIF appear correctly?

262 Views Asked by At

I created a GIF and it is basically snow particles falling and has a transparent background. Therefore I can have just snow flowing over my other PNGs and images on the app. The problem is that the app loads and the GIF appears all white. Not sure why because I gave it transparency when making it. If I lower the alpha in Xcode I still don't see my old PNGs (usual background image).

This is in my 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];
1

There are 1 best solutions below

0
On

You can set your view background Clear color And for animated image you can use UIImageView. hope this will be work proper. See Link:: - Click here to get code Link2::- Click here for code