gpt4 book ai didi

ios - SDWebImage 动画图像

转载 作者:行者123 更新时间:2023-11-29 10:40:45 26 4
gpt4 key购买 nike

我尝试了 100 多种使用 SDWebImage 制作图像动画的方法,但总是失败。我理解使用 block 好吗?我有 IBOutlet 属性图像名称 images1。我制作了数组来存储值并为 3 个图像制作动画。

  NSMutableArray *imagegallery = [[NSMutableArray alloc] init];

NSLog(@"IMAGES-%@", imagegallery);


[self.images1 setImageWithURL:[NSURL URLWithString:[self.objc objectForKey:@"Img1"]]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {

[imagegallery addObject:image];
NSLog(@"Ima1-------%@", image);
}];
[self.images1 setImageWithURL:[NSURL URLWithString:[self.objc objectForKey:@"Img2"]]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
[imagegallery addObject:image];
}];
[self.images1 setImageWithURL:[NSURL URLWithString:[self.objc objectForKey:@"Img3"]]
placeholderImage:[UIImage imageNamed:@"placeholder.png"]
completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType) {
[imagegallery addObject:image];
}];

self.images1.animationImages = imagegallery; //this line gets error
self.images1.animationDuration = 0.5;
[self.view addSubview:self.images1];
[self.images1 startAnimating];

最佳答案

我想当你设置 self.images1.animationImages = imagegallery 因为你的图片还不能加载,method setImageWithURL:placeholderImage:completed: 是一个异步函数.你应该尝试另一种方式喜欢: Animate images in uiimageview

关于ios - SDWebImage 动画图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24665715/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com