[英]Parse.com iOS issue, PFImageView does not seem to support CopyWithZone
i am sending a PFImageView*(Parse.com subclass of UIImageView)* to a new View, where i am adding it as a subview, this ofc leads to the PFImageView getting detached from its previous view, which id like to avoid. 我正在将PFImageView *(UIImageView的Parse.com子类)*发送到新的View,在其中将其添加为子视图,这导致PFImageView与之前的视图分离,此ID希望避免。
I have to call Copy, and CopyWithZone on the PFImageView, but the class does not seem to support that method, i have also tried the following: 我必须在PFImageView上调用Copy和CopyWithZone,但是该类似乎不支持该方法,我还尝试了以下方法:
UIImage *copiedImage = [[UIImage alloc] initWithCGImage:[[sender image] CGImage]];
PFImageView *copiedImageView = [[PFImageView alloc] initWithImage:copiedImage];
[segue.destinationViewController setFullSizeImage:copiedImageView];
But this leads to an empty PFImageView? 但这会导致一个空的PFImageView吗? Can i add a category to PFImageView and implement the CopyWithZone protocol ?
我可以向PFImageView添加类别并实现CopyWithZone协议吗? And if so, how would i implement it?
如果是这样,我将如何实施?
fixed it by implementing a category with the following: 通过实现以下类别来解决此问题:
-(id)copyPFImageView
{
PFImageView *copy = [[PFImageView alloc] init];
[copy setFile:[self file]];
[copy setImage:[self image]];
return copy;
}
Remember that the data in file is quite essential 请记住,文件中的数据非常重要
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.