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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-20-2011, 02:36 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 5
timgym is on a distinguished road
Send a message via AIM to timgym
Default UIViewImage added to email?

First time member and post to the site so sorry if i did something incorrect. Anyway I am creating an application that allows the user to select a picture from their photo library and attaches it to a UIViewImage on the screen. Once the user selects the image of their choice they then select a button that takes them to an email screen with the chosen image attached to the email. My problem lies in getting the image chose from UIIMageView attached to the email? I looked at apple's "MailComposer" app and was able to append text, but appending the image to the email is something i cant seem to find any help on.
This is apple's default code. But in terms of putting my picture into the email, the problems lies in the fact that theres no static path. The path to the photo will change depending on what the user selects?

NSString *path = [[NSBundle mainBundle] pathForResource:@"rainy" ofType:@"png"];
NSData *myData = [NSData dataWithContentsOfFileath];
[picker addAttachmentData:myData mimeType:@"image/png" fileName:@"rainy"];
timgym is offline   Reply With Quote
Old 03-20-2011, 04:24 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

pathForResource will take a file from the bundle, not the library. If you already loaded a file an showed it in the image view, use something like this instead

NSData *imageData = UIImagePNGRepresentation(imageView.image);
baja_yu is offline   Reply With Quote
Old 03-20-2011, 07:33 PM   #3 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 5
timgym is on a distinguished road
Send a message via AIM to timgym
Default

Quote:
Originally Posted by baja_yu View Post
pathForResource will take a file from the bundle, not the library. If you already loaded a file an showed it in the image view, use something like this instead

NSData *imageData = UIImagePNGRepresentation(imageView.image);


Wahoo this worked great!, thanks a lot i appreciate it, this took me forever to find...last thing, is there a default file format that the iOS photo album uses to save images. I tried a number of other pictures that i didnt know the extension of off hand and they didnt work obviously because they werent PNG files. Is there a way to allow for a number of different photo formats, or is it up to me to make a number of if else statements accepting other kinds?
timgym is offline   Reply With Quote
Old 03-20-2011, 08:21 PM   #4 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 5
timgym is on a distinguished road
Send a message via AIM to timgym
Default

Quote:
Originally Posted by timgym View Post
Wahoo this worked great!, thanks a lot i appreciate it, this took me forever to find...last thing, is there a default file format that the iOS photo album uses to save images. I tried a number of other pictures that i didnt know the extension of off hand and they didnt work obviously because they werent PNG files. Is there a way to allow for a number of different photo formats, or is it up to me to make a number of if else statements accepting other kinds?
Nevermind!, all set, thanx again i appreciate the help!
timgym is offline   Reply With Quote
Reply

Bookmarks

Tags
email, image, uiimageview

Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 348
10 members and 338 guests
condor304, Creativ, Domele, dreamdash3, laureix68, LEARN2MAKE, michelle, mistergreen2011, Sami Gh, tinamm64
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,661
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, tinamm64
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:31 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0