views:

76

answers:

0

HI there. I've tryed to develop a little magazine reader for IPAD I use a subClass of CAtiledLAyer whit drawInContex Method and I draw the pdf pages into a scrollView. So i've 2 problem, 1-when i try the app whit simulator all work fine but when i try the app on ipad the layer drawing it's slow , 2-the memory usage allways increases and when i release the CatiledLayer and all the objetc the memory do not decreases

Any idea??

for(int i=0;i<CGPDFDocumentGetNumberOfPages(myDocumentRef);i++)
{

 myle = [CustomTiledLayer layer];
    myle.tileSize= CGSizeMake(512, 768);
    myle.levelsOfDetail =1;
    myle.levelsOfDetailBias = 0;
    myle.frame = CGRectMake(512*i, 0,512, 765);

    myle.myPageRef=CGPDFDocumentGetPage(myDocumentRef,i+1+1);
    [pages addObject:myle];

}

this is the loop that load array of CatiledLayer

myContentView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,512*[pages count], 765)];
0,zio.size.width*CGPDFDocumentGetNumberOfPages(myDocumentRef), zio.size.height)];

for (int i=0; i<CGPDFDocumentGetNumberOfPages(myDocumentRef); i++) 
{
    [myContentView.layer addSublayer:[pages objectAtIndex:i]];
}

and in this lopp i add the layer into the main UIVIew

 -(void)drawInContext:(CGContextRef)ctx
 {
    //CGContextGetUserSpaceToDeviceSpaceTransform(ctx);
        CGContextSetRGBFillColor(ctx, 1.0, 1.0, 1.0, 1.0);
        NSLog(@"nacchio");

    //  NSLog(@"%i",i);     
    //  CGContextSaveGState(ctx);
        CGContextTranslateCTM(ctx,0,self.bounds.size.height);   
        CGContextScaleCTM(ctx, 1.0, -1.0);
        CGContextFillRect(ctx, self.bounds);
        CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(myPageRef, kCGPDFCropBox, self.bounds , 0, true));
        CGContextDrawPDFPage(ctx, myPageRef);
    //  CGContextRestoreGState(ctx);







   }

this is my drawInContext method of CatiledLyare subclass;