1

a noob question here.

i would like to give the user a button that would prep an email with the content of a UIView attached.

is this (easily) doable ? I know how to create a basic email, but not with attachments and certainly not with a dump of an UIView content. I am guessing this would be a two step process. First get the content of the UIView into a "attachable form" (how ? #1). Then attach it. (how ? #2)

could someone please point me the right direction ?

thank you!

Ishu
  • 12,797
  • 5
  • 35
  • 51
EarlGrey
  • 2,514
  • 4
  • 34
  • 63

1 Answers1

0

i think you can start by converting the UIView to an image.

UIGraphicsBeginImageContext(myView.bounds.size);
[myView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

after that you can read that to see how to attach the image to the mail

http://howtomakeiphoneapps.com/2009/07/how-to-make-your-iphone-app-send-email-with-attachments/

good luck

shannoga
  • 19,649
  • 20
  • 104
  • 169
  • thanks for the reply ... I think that I would need to transform the UIImage into a jpg file and save it in the filesystem before being able to attach it. – EarlGrey Dec 14 '10 at 07:22
  • found how to save it to a file here: http://stackoverflow.com/questions/3051630/save-uiviews-representation-to-file – EarlGrey Dec 14 '10 at 07:28