Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

azg442

macrumors newbie
Original poster
May 10, 2009
12
0
How would you crop an image using CGrectMake? I'm having a lot of trouble. Thanks!

Here is the code im using...

Code:
UIImage *spriteImage = [UIImage imageNamed:@"spritesheet.png"];
	
sprite.image = spriteImage;	
	
sprite.frame = CGRectMake(110.0, 180.0, 100.0, 100.0);
 
One way is to use CGImageCreateWithImageInRect(). Get the CGImage from your UIImage, pass it to that function, then create a new UIImage from the CGImage you just created.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.