我需要显示gif图像,我已尝试
SKSpriteNote
但它不支持gif。所以我想用
UIImageView
相反
在MyScene.m init方法中:
#import "UIImage+animatedGIF.h"
CGSize size = CGSizeMake(144, 82);
//create a uiview on top of skview
self.demoView = [[UIImageView alloc] initWithFrame:CGRectMake(self.view.bounds.size.width / 2 - size.width / 2, self.view.bounds.size.height / 2 - size.height / 2, size.width, size.height)];
[self.view addSubview:self.demoView];
//set the image to be the gif (I use a category from github)
self.demoView.image = [UIImage animatedImageWithAnimatedGIFURL:[NSURL URLWithString:[Helper pathInBundleWithFileName:[self demoFileNameWithStep:step]]]];
[self.demoView startAnimating];
这与gif图像无关,因为即使我尝试静态png图像,也不会显示图像视图。
我也尝试过,但也不起作用:
[self.view.superview addSubview:self.demoView];
[self.view.superview bringSubviewToFront:self.demoView];