- (UIImage *) ButtedBackPic: (CGPoint) ScreenPoint
{
NSInteger iPicX;
NSInteger iPicY;
iPicX = ScreenPoint.x;
iPicY = ScreenPoint.y;
UIImage * Image1 = [UIImage imageNamed: @ "text1.png"];
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB ();
/ / Create a memory picture of the context root
CGContextRef context;
context = CGBitmapContextCreate (NULL, SCREEN_W, SCREEN_H, 8, 4 * SCREEN_W, colorSpace, kCGImageAlphaPremultipliedFirst);
/ / Will draw a picture into memory image
CGContextDrawImage (context, CGRectMake (0, 0, SCREEN_W, SCREEN_H), Image1.CGImage);
/ / Copy the memory image snapshot
CGImageRef imageMasked = CGBitmapContextCreateImage (context);
Define and initialize
return imageUIImage * retuImage = [[UIImage alloc] initWithCGImage: imageMasked];
/ / Release the Drawing Explorer
CGContextRelease (context);
CGColorSpaceRelease (colorSpace);
CGImageRelease (imageMasked);
return retuImage;
}
The method then calls the class in the view controller, and the method returns the image gives a view controller class
ViewbacImage = [ScreenMap ButtedBackPic: CGPointMake (iAA, 0)];
((JHCX1_0View *) self.view) bakImage = bacImage;.
[(JHCX1_0View *) self.view setNeedsDisplay];
Then View the drawRect method of drawing and releasing UIImage
[BakImage drawAsPatternInRect: rect];
[BakImage release];
The code is executed once is normal, but if the
view controllerbacImage = [ScreenMap ButtedBackPic: CGPointMake (iAA, 0)];
((JHCX1_0View *) self.view) bakImage = bacImage;.
[(JHCX1_0View *) self.view setNeedsDisplay];
Three sentences into Timer repeatedly execute, execute two minutes later, iPhone simulator images will be more cards, the last black and white, with no memory leak checking Instruments suspected memory leak is invisible, but where is the result, is puzzling, seeking help heroes
Reply:
to learn, the Great God it quickly to Chou ChouReply:
bakImage property is assign or retain the? If retain the words, ((JHCX1_0View *) self.view) bakImage = bacImage;. Behind the need [bacImage release]?
Reply:
If the project is not possible, then the project into ARC model to try to see the card will not be so.
Or direct this part of the code used to create a new project under the ARC model tests.
No comments:
Post a Comment