NSString *name = @"ok.gif";
NSString *filePath = [[NSBundle bundleWithPath:[[NSBundle mainBundle] bundlePath]] pathForResource:name ofType:nil];
NSData *imageData = [NSData dataWithContentsOfFile:filePath];
imgview = [[UIImageView alloc] initWithImage: [UIImage sd_animatedGIFWithData:imageData]];
imgview.frame = CGRectMake([UIScreen mainScreen].bounds.size.width-50, [UIScreen mainScreen].bounds.size.height/2, 50, 50);
[self.view addSubview:imgview];
[self.view bringSubviewToFront: imgview];
UIImageView加载动态gif图片
最新推荐文章于 2024-08-16 08:21:02 发布
本文介绍如何将GIF图像加载到iOS应用中,并展示了一个具体的实现示例,包括资源路径设置、图像数据读取及UIImageView的使用。
4971

被折叠的 条评论
为什么被折叠?



