您的位置:首页 > 其它

加载gif图片的方法:(需要SDWebImage方法)

2014-12-02 18:59 357 查看
加载gif图片的方法:(需要SDWebImage方法)

/**
* 加载图片
*/
- (void)initLoadingImageView
{
NSString *name =
@"loading.gif";
NSString *filePath = [[NSBundle
bundleWithPath:[[NSBundle
mainBundle] bundlePath]]
pathForResource:name ofType:nil];
NSData *imageData = [NSData
dataWithContentsOfFile:filePath];

if (!self.loadingImageView) {
self.loadingImageView = [[UIImageView
alloc]init];
}
// imgView.image = [UIImage animatedImageWithAnimatedGIFData:imageData];
self.loadingImageView.backgroundColor = [UIColor
clearColor];
self.loadingImageView.image = [UIImage
sd_animatedGIFWithData:imageData];
self.loadingImageView.frame =
CGRectMake(0,
0, 100,
250/2.0);
[self.view
addSubview:self.loadingImageView];
[self.view
bringSubviewToFront:self.loadingImageView];
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: