So I read here on SO that I can encode a CGLayerRef to a NSValue using
NSValue *myCopy = [[NSValue alloc] initWithBytes:&myLayer objCType:@encode(CGLayerRef)];
but how do I recreate the CGLayerRef from myCopy?
thanks
So I read here on SO that I can encode a CGLayerRef to a NSValue using
NSValue *myCopy = [[NSValue alloc] initWithBytes:&myLayer objCType:@encode(CGLayerRef)];
but how do I recreate the CGLayerRef from myCopy?
thanks
This should work:
CGLayerRef giveMeBackTheLayer;
[myCopy getValue:&giveMeBackTheLayer];
CGLayerRef
? It’s probably a combination of class_getInstanceSize()
and sizeof CGLayerRef
. The actual layer struct
is opaque, though. –
Pule NSValue
. –
April sizeof CGLayerRef
, then. Note that CGLayerRef
is a pointer, so it has the same size as any other pointer in your target platform: 32 bits. –
Pule © 2022 - 2024 — McMap. All rights reserved.