gpt4 book ai didi

ios - UIImageView没有更新

转载 作者:行者123 更新时间:2023-12-01 17:31:49 24 4
gpt4 key购买 nike

嗨,iam,当我加载该UIviewcontroller时,使用以下代码将图像加载至uiimageview,但如果我从现有的uiviewcontroller中打开任何其他uiviewcontroller并返回到旧的uiviewcontroller,并且如果单击缩略图图像,则不会更新UIimageview uiviewcontroller。

img包含图像路径(设备内部)
在viewdidload

[self setBookimage:img];

在setBookimage()中
- (void)setBookImage:(UIImage *)bookImage{

book_cover_image.image=nil;
book_cover_image.image = bookImage;
CATransition *transition = [CATransition animation];
transition.duration = 1.0f;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
transition.type = kCATransitionFade;

[book_cover_image.layer addAnimation:transition forKey:nil];
}

缩略图didselect方法代码
   - (void)thumbnailListView:(ThumbnailListView*)thumbnailListView
didSelectAtIndex:(NSInteger)index
{

//filePathsofimages contains 10 image paths

//下面的代码更新图像,如果正在加载uiviewcontroller并单击缩略图,而不是打开另一个viewcontroller并返回然后单击。
     img =[[UIImage alloc]initWithContentsOfFile:[filePathsofImages objectAtIndex:index]];
[self setBookImage:img];
}

最佳答案

尝试:

[book_cover_image setNeedsDisplay];

关于ios - UIImageView没有更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19057723/

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