Posts Tagged ‘CGImageCreateWithImageInRect’

[iOS] Call CGImageCreateWithImageInRect with CGImageRelease

Wednesday, December 22nd, 2010
	NSString *path = [[NSBundle mainBundle] pathForResource:@"myimage" ofType:@"png"];
	UIImage *img = [[UIImage alloc] initWithContentsOfFile:path];
	CGImageRef clipImage = CGImageCreateWithImageInRect(img.CGImage, CGRectMake(0, 100, 100, 200));
	//do something
	CGImageRelease(clipImage);
	[img release];