i want attach multi photos to one mail for my application with this code i can attach only the last one photos to mail but i can read all photos in uiimageview how can attaching all photos to one mail ? here is the codes for read image
- (void)elcImagePickerController:(ELCImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info {
[self dismissModalViewControllerAnimated:YES];
////
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController * mailControler = [[MFMailComposeViewController alloc]init];
mailControler.mailComposeDelegate = self;
mailControler.modalPresentationStyle = UIModalPresentationFormSheet;
NSString *emailBody = @""; // optional
[mailControler setMessageBody:emailBody isHTML:YES];
for (UIView *v in [scrollview subviews]) {
[v removeFromSuperview];
}
CGRect workingFrame = scrollview.frame;
workingFrame.origin.x = 0;
for(NSDictionary *dict in info) {
imageview = [[UIImageView alloc] initWithImage:[dict objectForKey:UIImagePickerControllerOriginalImage]];
[imageview setContentMode:UIViewContentModeScaleAspectFit];
imageview.frame = workingFrame;
[scrollview addSubview:imageview];
[imageview release];
workingFrame.origin.x = workingFrame.origin.x + workingFrame.size.width;
NSLog(@"image %@", imageview.image);
NSData * data = UIImageJPEGRepresentation(imageview.image, 0.0);
[mailControler addAttachmentData:data mimeType:@"image/jpeg" fileName:@"Photos"];
}
[scrollview setPagingEnabled:YES];
[scrollview setContentSize:CGSizeMake(workingFrame.origin.x, workingFrame.size.height)];
}
Part 2 go mail
-(IBAction)actionEmailComposer
{
[self presentViewController:mailControler animated:YES completion:nil];
}
the app is crashed