iphone - Attach an captured image to an email on clicking a button -
After the
I have captured the image from the iPhone using the See the above Sorry for any mistake in my code Modify your This method, though as, that you have declared your email button, assuming Now add this method as your button goal immediately after that button, Now image reps set in 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]; }
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]; }
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]; }
- (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]; }
UIButton * emailbutton = [UIButton buttonWithType: UIButtonTypeRoundedRect]; // or any other method
[emailbutton addTarget: self Action: @selector e-mailbootpress) Control Event: UIControlEventTouchUpInside];
email button you
self.myimageview.image in
UIImagePickerController Will be sent as an attachment.
Comments
Post a Comment