Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 15, 2011, 11:47 AM   #1
benc555
macrumors newbie
 
Join Date: Nov 2008
How to split image?

Hey,
How can I split a UIImage(in a UIImageView) in half, into 2 different images?

Thanks!
benc555 is offline   0 Reply With Quote
Old Aug 15, 2011, 12:28 PM   #2
ViviUO
macrumors 6502
 
Join Date: Jul 2009
Just wondering ... why?
ViviUO is offline   0 Reply With Quote
Old Aug 15, 2011, 01:26 PM   #3
dantastic
macrumors 6502
 
Join Date: Jan 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.

Last edited by dantastic; Aug 15, 2011 at 01:27 PM. Reason: typo
dantastic is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
How to convince my parents to let me buy a 17" MacBook Pro Ulf1103 Buying Tips and Advice 58 Nov 27, 2013 11:45 AM
Tutorial: How to get PCSX2 to run on Mac (without BootCamp) Mirrors Mac Applications and Mac App Store 22 Jun 14, 2013 08:19 PM
IPHONE 4 how to JAILBREAK AND UNLOCK bs2511feist Jailbreaks and iOS Hacks 6 Apr 14, 2012 05:52 PM
Does anybody know how to get TweetTask? xmelissaxmayhem Jailbreaks and iOS Hacks 3 Jul 3, 2011 01:21 AM
[HOW TO] DIY iPhone 4 Swivel Car Mount QuarterSwede iPhone Accessories 13 Mar 8, 2011 02:51 PM


All times are GMT -5. The time now is 07:36 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC