使用下面的代码,我已经成功地使我的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 transition self.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:
这被称为就像细胞在可见区域之外.尝试将图像设置为零或无图像.应该工作
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。