如何创建UIImageView实例的副本? [英] How do you create a copy of an UIImageView instance?
本文介绍了如何创建UIImageView实例的副本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何创建可以独立于第一个实例操作的UIImageView实例的副本?
How do I create a copy of an UIImageView instance that can be manipulated independently of the first instance?
我试过 UIImageView * tempCopy = [实例复制]
但它崩溃了。还有另一种方法吗?
I've tried UIImageView *tempCopy = [instance copy]
but it crashes. Is there another way?
推荐答案
它可能崩溃,因为UIImageView不符合 NSCopying 协议。所以自己动手:实例化一个新的UIImageView并设置您感兴趣的原始属性。
It probably crashes because UIImageView doesn't conform to the NSCopying protocol. So do it yourself: instantiate a new UIImageView and set any property from your original that you find of interest.
这篇关于如何创建UIImageView实例的副本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文