I was wondering if there is a way to allow the user to select an image from the camera roll, and then attach it to an email?
Here is the code I have now:
-(IBAction) openEmail {
MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init];
[mailComposer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
[mailComposer setToRecipients:[NSArray arrayWithObjects:@"TPsecondary_Example@email.com", nil]];
[mailComposer setSubject:@"Learning Trail Submission"];
[mailComposer setMessageBody:emailbody isHTML:NO];
[mailComposer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
NSString *path = [[NSBundle mainBundle] pathForResource:@"Answer" ofType:@"plist"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[mailComposer addAttachmentData:myData mimeType:@"application/xml" fileName:@"Answer.plist"];
[self presentModalViewController:mailComposer animated:YES];
}
}
There sure is!
In your .h file add these delegates and declare a
UIImagenamed selectedImage.Then in your .m you can add the following.
Link
-(IBAction)openImagePicker:(id)senderto the button that you want to start the process.EDIT: Mind you this is a very basic example that doesn’t handle events such as the user selecting a video instead of an image…