iphone - Attach an captured image to an email on clicking a button -


After the

I have captured the image from the iPhone using the UIImagePickerController delegate method.

  - (minus) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info {UIImage * image = [information objectForKey: @ "UIImagePickerControllerOriginalImage"]; Self.myImageView.image = image; // [Self Performance Selector: @Selector (EmailButtonPress :) Item: After Image: 19]; [Remove from Self Modul Vij Controls permission: Yes]; }   

See the above email button pressed method, which was called by itself . I want to call it in a button action I have written the code below for emailButtonPressed

  - (zero) emailButtonPressed: (UIImage *) image { MFMailComposeViewController * mailview = [[MFMailComposeViewController alloc] init]; Mailview.navigationBar.txtColor = [UIColor colorWithRed: 55 / 255.0 green: 190 / 255.0 blue: 55 / 255.0 alpha: 1]; Mailview.mailComposeDelegate = self; // NSMutableString * Subject = [NSMutableString stringWithFormat: @ "% @", @ "test"]; [MELVUE SET theme: @ "Picture from my iPhone!"]; // NSString * email_new = @ ""; [MailWeet Set Message Bid: @ "Details" is HTML: no]; NSDTa * ImageData = UIImagePNG Mapping (Image); [MELVUE AD Attachment Data: ImageData Mimetype: @ "Image / PGN" filename: @ "Image Name"]; [Self-Present Model Viewer: MailView Animated: Yes]; }   

Sorry for any mistake in my code

Modify your emailButtonPressed method as follows,

  - (zero) EmailButtonpress is the ultimate (UIImage * image = self.myimageview.image; // some other ultimate set as the image = self.image; whatever you picker set representative method MFMailComposeViewController * mailview = [[MFMailComposeViewController alloc] init]; Mailview.navigationBar.tintColor = [UIColor colorWithRed: green 55 / 255.0: 190 / 255.0 Blue: 55 / 255.0 alpha: 1]; mailview.mailComposeDelegate = self; // NSMutableStr ing * Subject = [NSMutableString stringWithFormat: @ "% @", @ "test"] [Melwu set topic: @ "pictures from my iPhone!"]; // NSString * email_new = @ ""; [Melwu set Mesejbeedi: @ "description" HTML: No]; Ansdita * Cvideta = UIImagePNG mapping (image) [Melwu Ed Atacmentdata: Cvideta Mimetype: @ "image / Pijian" filename: @ "Imejanam"] [self current model Drishykantrolr: Melwu animated : Yes]; }   

This method, though as,

  - (minus) image picture Controller: (UIImagePickerController *) had picker FinishPickingMediaWithInfo: (NSDictionary * ) Info {UIImage * image = [For information item: @ "UIImagePickerControllerOriginalImage"]; Self.myImageView.image = image; // Instead, you can create an @ property for the image in .h file and allocate it here too. [Remove from Self Modul Vij Controls permission: Yes]; }   

that you have declared your email button, assuming

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

Now add this method as your button goal immediately after that button,

  [emailbutton addTarget: self Action: @selector e-mailbootpress) Control Event: UIControlEventTouchUpInside];   

Now image reps set in email button you self.myimageview.image in UIImagePickerController Will be sent as an attachment.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -