B benc555 macrumors newbie Original poster Nov 29, 2008 3 0 Aug 15, 2011 #1 Hey, How can I split a UIImage(in a UIImageView) in half, into 2 different images? Thanks!
dantastic macrumors 6502a Jan 21, 2011 572 678 Aug 15, 2011 #3 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: Aug 15, 2011
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.