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

benc555

macrumors newbie
Original poster
Nov 29, 2008
3
0
Hey,
How can I split a UIImage(in a UIImageView) in half, into 2 different images?

Thanks!
 
off the top of my head now but...

Code:
CGRect newImgFrame = CGRectMake(100, 100, 50, 50);
UIImage *image = [UIImage imageNamed:@"img.png"];
CGImageRef imageRef = CGImageCreateWithImageInRect(image, newImgFrame);
image = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);

This will leave you with a UIImage in 'image' that is 50x50px taken from 100/100.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.