我使用下面的UIImagePickerController
委托方法从 iphone 捕获了图像。
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
self.myImageView.image = image;
// [self performSelector:@selector(emailButtonPressed:) withObject:image afterDelay:1.0];
[self dismissModalViewControllerAnimated:YES];
}
请参阅上面的emailButtonPressed
方法,它是由 调用的self
。我想在按钮操作中调用它。我为emailButtonPressed
.
- (void)emailButtonPressed:(UIImage *)image
{
MFMailComposeViewController *mailview=[[MFMailComposeViewController alloc]init]; mailview.navigationBar.tintColor=[UIColor colorWithRed:55/255.0 green:190/255.0 blue:55/255.0 alpha:1];
mailview.mailComposeDelegate=self;
// NSMutableString *subject=[NSMutableString stringWithFormat:@"%@",@"Testing"];
[mailview setSubject:@"Picture from my iPhone!"];
// NSString *email_new=@"";
[mailview setMessageBody:@"Description" isHTML:NO];
NSData *imageData = UIImagePNGRepresentation(image);
[mailview addAttachmentData:imageData mimeType:@"image/png" fileName:@"ImageName"];
[self presentModalViewController:mailview animated:YES];
}
抱歉我的代码中的任何错误。