ios – 在customCell中循环浏览uiimageview

ios – 在customCell中循环浏览uiimageview,第1张

概述你好,我有产品表和产品详细信息视图为每个产品我有很多图像,下载和缓存在磁盘和内存,每次用户选择一个产品,以检查其细节我正在检索缓存的图像,并设置为我的四UI ImageView在UITableViewController中的自定义单元格内,我无法设置图像,尽管我可以通过NSLog()函数记录它我正在使用此代码: int index = 0; int indexOfImages = 1; 你好,我有产品表和产品详细信息视图为每个产品我有很多图像,下载和缓存在磁盘和内存,每次用户选择一个产品,以检查其细节我正在检索缓存的图像,并设置为我的四UI ImageVIEw在UItableVIEwController中的自定义单元格内,我无法设置图像,尽管我可以通过NSLog()函数记录它我正在使用此代码:
int index = 0;    int indexOfImages = 1;    self.imageCache = [[SDImageCache alloc] initWithnamespace:@"menuImage"];   for ( UIImageVIEw *currentimageVIEw in cell.contentVIEw.subvIEws)    {        NSLog(@"the imageindex is: %d",indexOfImages);        NSLog(@"the index is: %d",index);        NSLog(@"the count is: %lu",(unsigned long)[self.currentProduct.mirsaProductUrlimage count]);        if (index < [self.currentProduct.mirsaProductUrlimage count] ) {             [self.imageCache @R_301_5962@diskCacheForKey:self.currentProduct.mirsaProductUrlimage[indexOfImages]      done:^(UIImage *image,SDImageCacheType cacheType) {                if (image) {                   currentimageVIEw.image =  image;                }            }];            indexOfImages++;            index++;         }         else        {            break;        }    }

and if i try to change the loop way to this

for ( UIImageVIEw *currentimageVIEw in self.tableVIEw.subVIEws)

i got this error UItableVIEwWrapperVIEw setimage:]: unrecognized selector sent to instance

我只是想知道我是否以错误的方式循环,我的意思是我无法通过这个循环达到他们或发生了什么?

解决方法 你必须改变循环:
for ( UIVIEw *currentVIEw in cell.contentVIEw.subvIEws)   {      if([currentVIEw isKindOfClass:[UIImageVIEw class]])      {           // here Do All the stuff for imageVIEws      }   }

做所有这些东西在cellForRowAtIndexPath
并改变imageVIEw图像采取的弱视频imageVIEw这样的例子:

__weak UIImageVIEw *weakImage = currentimageVIEw; [self.imageCache @R_301_5962@diskCacheForKey:self.currentProduct.mirsaProductUrlimage[indexOfImages]      done:^(UIImage *image,SDImageCacheType cacheType) {                if (image) {                    weakImage.image =  image;                } }];
总结

以上是内存溢出为你收集整理的ios – 在customCell中循环浏览uiimageview全部内容,希望文章能够帮你解决ios – 在customCell中循环浏览uiimageview所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1096987.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-28
下一篇2022-05-28

发表评论

登录后才能评论

评论列表(0条)

    保存