开发者

iPhone - encoding and decoding a NSValue

开发者 https://www.devze.com 2023-03-10 01:42 出处:网络
So I read here on SO that I can encode a CGLayerRef to a NSValue using NSValue *myCopy = [[NSValue all开发者_C百科oc] initWithBytes:&myLayer objCType:@encode(CGLayerRef)];

So I read here on SO that I can encode a CGLayerRef to a NSValue using

NSValue *myCopy = [[NSValue all开发者_C百科oc] initWithBytes:&myLayer objCType:@encode(CGLayerRef)]; 

but how do I recreate the CGLayerRef from myCopy?

thanks


This should work:

CGLayerRef giveMeBackTheLayer;
[myCopy getValue:&giveMeBackTheLayer];
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号