简体   繁体   English

iPhone - 编码和解码 NSValue

[英]iPhone - encoding and decoding a NSValue

So I read here on SO that I can encode a CGLayerRef to a NSValue using所以我在这里读到了,我可以使用 CGLayerRef 将 CGLayerRef 编码为 NSValue

NSValue *myCopy = [[NSValue alloc] initWithBytes:&myLayer objCType:@encode(CGLayerRef)]; 

but how do I recreate the CGLayerRef from myCopy?但是如何从 myCopy 重新创建 CGLayerRef?

thanks谢谢

This should work:这应该有效:

CGLayerRef giveMeBackTheLayer;
[myCopy getValue:&giveMeBackTheLayer];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM