【发布时间】:2011-05-17 01:05:22
【问题描述】:
用户拍照后,我成功地将图像保存到我的应用程序中。我稍后要做的是,当用户返回应用程序时,我希望他们能够将照片作为附件通过电子邮件发送。我没有任何运气将应用程序中的数据转换为图像,因此我可以将其添加为附件。有人可以指出我正确的方向吗?这是他们拍照后我保存图像的地方。
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
//here is the image returned
app.aImage2 = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *imageData = UIImagePNGRepresentation( app.aImage2 );
NSString * savedImageName = [NSString stringWithFormat:@"r%@aImage2.png",app.reportNumber];
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentsDirectory = [paths objectAtIndex:0];
NSString * dataFilePath;
dataFilePath = [documentsDirectory stringByAppendingPathComponent:savedImageName];
[imageData writeToFile:dataFilePath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
}
这里是我需要附加它的地方。
//this is inside my method that creates an email composer view
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self; // <- very important step if you want feedbacks on what the user did with your email sheet
//how would i attach the saved image from above?
【问题讨论】:
标签: iphone ios4 iphone-sdk-3.0