Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can convert your view to an image, then you could create an email with it.</p> <p>This code (<a href="http://iphonedevelopertips.com/email/how-to-send-email-with-attachments-example-using-iphone-camera-to-email-a-photo.html" rel="nofollow noreferrer">from here</a>) will allow you to send an email with an attachment:</p> <pre><code> - (void)emailImageWithImageData:(NSData *)data { MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init]; picker.mailComposeDelegate = self; // Set the subject of email [picker setSubject:@"Picture from my iPhone!"]; // Add email addresses // Notice three sections: "to" "cc" and "bcc" [picker setToRecipients:[NSArray arrayWithObjects:@"emailaddress1@domainName.com", @"emailaddress2@domainName.com", nil]]; [picker setCcRecipients:[NSArray arrayWithObject:@"emailaddress3@domainName.com"]]; [picker setBccRecipients:[NSArray arrayWithObject:@"emailaddress4@domainName.com"]]; // Fill out the email body text NSString *emailBody = @"I just took this picture, check it out."; // This is not an HTML formatted email [picker setMessageBody:emailBody isHTML:NO]; // Attach image data to the email // 'CameraImage.png' is the file name that will be attached to the email [picker addAttachmentData:data mimeType:@"image/png" fileName:@"CameraImage"]; // Show email view [self presentModalViewController:picker animated:YES]; //if you have a navigation controller: use that to present, else the user will not //be able to tap the send/cancel buttons //[self.navigationController presentModalViewController:picker animated:YES]; // Release picker [picker release]; } - (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { // Called once the email is sent // Remove the email view controller [self dismissModalViewControllerAnimated:YES]; } </code></pre> <p>To convert your view graphical representation to an image, use the code (<a href="https://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically">from here</a>):</p> <pre><code>UIGraphicsBeginImageContext(self.window.bounds.size); [self.window.layer renderInContext:UIGraphicsGetCurrentContext()]; UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); NSData * data = UIImagePNGRepresentation(image); [self emailImageWithImageData:data]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload