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

kmo19

macrumors member
Original poster
Jan 7, 2009
51
0
I know I can just use UIImage imageNamed:
But how would I do it using file paths? I've tried many variations of this:

Code:
NSString* imgName = @"test.png";
NSString* resourcePath = [[NSBundle mainBundle] resourcePath];
NSURL *url = [NSURL fileURLWithPath:[resourcePath stringByAppendingString:imgName]];

NSURLRequest* request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.