Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8780535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:04:40+00:00 2026-06-13T20:04:40+00:00

I have captured image from iphone using the below UIImagePickerController delegate method. – (void)

  • 0

I have captured image from iphone using the below UIImagePickerController delegate method.

    - (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];  
}

See above emailButtonPressed method it was called by self. I want to call this in a button action.
I wrote the code below for 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];  
}

sorry for any mistakes in my code.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:04:41+00:00Added an answer on June 13, 2026 at 8:04 pm

    Modify your emailButtonPressed method as follows,

    - (void)emailButtonPressed //removed the param
    {  
            UIImage *image = self.myimageview.image; //or set some other param as image = self.image; whichever you set in picker delegate method
            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];  
    }
    

    Keep this method as is,

    - (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
    {
        UIImage *image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
        self.myImageView.image = image;  //instead of this, you can create an @property for image in .h file and assign to that also here.
        [self dismissModalViewControllerAnimated:YES];  
    }
    

    Assuming that you have declared your email button as,

    UIButton *emailbutton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; //or any other way
    

    Now add this method as your button target immediately after that line,

    [emailbutton addTarget:self action:@selector(emailButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    

    Now on tap of emailbutton whatever image you have set in self.myimageview.image in UIImagePickerController delegate will be sent as an attachment.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one audio file captured from my iphone. I want to upload this
I have a byte[] I captured from Kinect using OpenKinect and it's Java JNA
I have raw data of an image captured from my phone, it's resolution is
I have developed an application to upload image captured from camera to server. I
I want to be able to take an image that i have already captured
I have an Web-application in which I capture Image using EdgeCamShots Sample Application Saving
I have the following code to display an image in imagebox using EmgucV: Capture
I have 5 views in my ASP.NET MVC application. Some data were captured from
I am trying to crop image by my custom cropper. Not from the UIImagePickerController's.
I'm trying to do some image processing on iPhone. I'm using http://developer.apple.com/library/ios/#qa/qa2010/qa1702.html to capture

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.