0

GIF を作成しました。基本的には雪の粒子が落ちてきて、背景が透明になっています。したがって、アプリ上の他の PNG や画像の上に雪が流れるだけです。問題は、アプリが読み込まれ、GIF がすべて白く表示されることです。作るときに透明感を出してしまったのでわかりません。Xcode でアルファを下げても、古い 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];
4

1 に答える 1