Friday 15 July 2011

iphone - How to save and read a CGLayerRef, in a NSmutableArray -


I have a question about CGLayerRef "Elements" (because they are not the object!)

In

How can I archive and read CGLayerRef in this code?

To get a good framerate on my draw, my app, I want to store a list of CGLayerRef created from bitmap.

This is the code for store in NSMutableArray

  CGLayerRef imageLayer; // make my layer ... // init my NSMutableArray if (layerTable == zero) {layerTable = [[NSMutableArray alloc] init]; } // and archive my CGCLayer in NSValue [layerTable addObject] in this array: [[NSValue alloc] initWithBytes: imageLayer objctype: "CGLayerRef"]];  

Now the code for DrawRect in my view:

To attract "realIdp" is an integer to identify the layer.

  - (zero) DrawConnect: (CGCTEXTIF reference) {// Other code ... // Here I want to read my CGLARF // test with NSVL, but I want NSVLU NSVL * Val = [LayerTable ObjectOutIndex: Real IDP] does not know. ; CGLayerRef LayerTouch; [Val Mill Value: Layer Toshaw]; // Perhaps an error CGContextDrawLayerInRect (reference, imageRect, layerToShow); }  

Here, the code for change in my ID:

  - (zero) showThisId: (int) IDP {realIdp = idp; [Self-setday display]; };    

You have left the @ encod instruction:

[Layer Usable AddObject: [[NSVL Allocess] Init Withbits: Image Layer Object Type: "CGLARRF"]];

should read:

[layerTable addObject: [[NSValue alloc] initWithBytes: imageLayer objctype: @encode (CGLayerRef)]];

You have to give the address of a buffer at [NSValue getValue:] . So this line:

  [val getValue: layerToShow];  

should be:

  [val getValue: & amp; Show layer];  

I think that should work


No comments:

Post a Comment