Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 11-19-2008, 05:26 PM   #5 (permalink)
SkylarEC
New Member
 
Join Date: Nov 2008
Posts: 74
SkylarEC is on a distinguished road
Default

I'd probably go with something like this (simplified, yes, but it covers what you need to do).
Code:
UIGraphicsBeginImageContext(self.view.frame.size);
/*Draw your image into your context here */

UIImageWriteToSavedPhotosAlbum(UIGraphicsGetImageFromCurrentImageContext(), nil, nil, nil); 
UIGraphicsEndImageContext();
To fix your current issue though, try:
Code:
//If the image is within the root of your app.
[UIImage alloc imageNamed:@"pic.png"]; 

//Or, if it isn't in the root but is still within the app bundle: ie /My.app/Images
[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pic" ofType:@"png"]]];

//Or, if the image is in your Documents directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *pathToYourImage = [NSString pathWithComponents:[NSArray arrayWithObjects:documentsDirectory, @"pic.png", nil]];
[UIImage imageWithContentsOfFile:pathToYourImage];
SkylarEC is offline   Reply With Quote
 

» Advertisements
» Online Users: 410
10 members and 400 guests
7twenty7, alexeir, Arty Tales, DaveDee, eski, Lily.P, networ, roof44, ryantcb, Sami Gh
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,594
Threads: 94,084
Posts: 402,779
Top Poster: BrianSlick (7,990)
Welcome to our newest member, kopmlop
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:14 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.