if you have UInavigationController
then you can add a bar button for sharing the content. Or you can add a share button in your viewcontroler.
Use MessageUI
. Add the delegates MFMessageComposeViewControllerDelegate, MFMailComposeViewControllerDelegate
.
- (IBAction)contactBtn:(id)sender {
if ([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
[controller setSubject:@"Subject"];
[controller setMessageBody:@" " isHTML:NO];
[controller setToRecipients:[NSArray arrayWithObjects:@"[email protected]",nil]];
controller.mailComposeDelegate = self;
[self presentViewController:controller animated:YES completion:NULL];
}
else{
UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Failed!" message:@"Mail can not be sent. Check your email settings." delegate:self cancelButtonTitle:@"Ok" otherButtonTitles: nil] ;
[alert show];
}
}
- (void) mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[self dismissViewControllerAnimated:YES completion:NULL];
}
MFMailComposeViewController canSendMail:
method. – rmaddy