ios – 如何清除UIView transitionWithView的效果

ios – 如何清除UIView transitionWithView的效果,第1张

概述使用下面的代码,我已经成功地使我的UI ImageView在其图像中消失. [UIView transitionWithView:myCell.myImageView duration:2.0 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{ myCell.myImageView.image = myIma 使用下面的代码,我已经成功地使我的UI ImageVIEw在其图像中消失.
[UIVIEw TransitionWithVIEw:myCell.myImageVIEw duration:2.0 options:UIVIEwAnimationoptionTransitionCrossdissolve animations:^{    myCell.myImageVIEw.image = myImage;} completion:NulL];

但是,当单元格被重用时,我需要删除此图像.
重复使用时,会显示最后的图像(在重复使用之前显示),然后转换为其应该是的图像,而不是从无图像转换为应该是的图像.

我试过了

-(voID)prepareForReuse {    [super prepareForReuse];// More is obvIoUsly needed than just setting image to nil when using a Transitionself.myImageVIEw.image = nil;[self.myImageVIEw setNeedsdisplay];// but I also trIEd removing all animations[self.myImageVIEw.layer removeAllAnimations];// and I even trIEd removing the sublayers,but still no success.[self.myImageVIEw.layer.sublayers makeObjectsPerformSelector:@selector(removeFromSuperlayer)];}

任何帮助不胜感激,但如果您不明白问题,请不要回答.评论,所以如果需要,我可以更好地解释.

谢谢!

解决方法 你可以利用回调

的tableVIEw:dIDEnddisplayingCell:forRowAtIndexPath:

这被称为就像细胞在可见区域之外.尝试将图像设置为零或无图像.应该工作

总结

以上是内存溢出为你收集整理的ios – 如何清除UIView transitionWithView的效果全部内容,希望文章能够帮你解决ios – 如何清除UIView transitionWithView的效果所遇到的程序开发问题。

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

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

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

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

发表评论

登录后才能评论

评论列表(0条)

    保存