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

  • SEARCH
  • Home
  • 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 6810593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:13:27+00:00 2026-05-26T20:13:27+00:00

Ok let me try to make it a better question. I have a tableViewController

  • 0

Ok let me try to make it a better question.

I have a tableViewController in my app containing some info that the user would like to email someone with that data from the tableview.

I could retain an array with that information.

The tough part of the question is how do i populate the body of the message with the data from my tableview using objective-c language ?

Do I have to make a huge string containing all the html code ? Or is there a better/easier way around it ? Even if it is a simple looking table just so the client will send that out to someone.

I guess any solution/advice could be a great waypoint for me to know how should i work with this.

  • 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-05-26T20:13:28+00:00Added an answer on May 26, 2026 at 8:13 pm

    I freaking nailed it !
    If you guys ever want to compose an email having the data from your UITableViewController
    here’s how i made it. Just remember to import your data header file…

    #import Recipe.h //in the implementation file
    #import Ingredients.h //in the implementation file
    #import <MessageUI/MFMailComposeViewController.h> // this line gotta be in the header file
    
    -(IBAction)sendmail{
    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
    [composer setMailComposeDelegate:self];
    NSString *recipeTitle = @"<h5>Recipe name: ";
    recipeTitle = [recipeTitle stringByAppendingFormat:recipe.name];
    recipeTitle = [recipeTitle stringByAppendingFormat:@"</h5>"];
    
    NSString *ingredientAmount = @"";
    NSString *ingredientAisle = @"";
    NSString *ingredientTitle = @"";
    
    NSString *tableFirstLine = @"<table width='300' border='1'><tr><td>Ingredient</td><td>Amount</td><td>Aisle</td></tr>";
    NSString *increments = @"";
    increments = [increments stringByAppendingFormat:recipeTitle];
    increments = [increments stringByAppendingFormat:tableFirstLine];
    int i;
    
    for (i=0; i < [ingredients count]; i++) {
        Ingredient *ingredient = [ingredients objectAtIndex:i];
        ingredientTitle = ingredient.name;
        ingredientAmount = ingredient.amount;
        ingredientAisle = ingredient.aisle;
    
        increments = [increments stringByAppendingFormat:@"<tr><td>"];
        increments = [increments stringByAppendingFormat:ingredientTitle];
        increments = [increments stringByAppendingFormat:@"</td><td>"];
        increments = [increments stringByAppendingFormat:ingredientAmount];
        increments = [increments stringByAppendingFormat:@"</td><td>"];
        increments = [increments stringByAppendingFormat:ingredientAisle];
        increments = [increments stringByAppendingFormat:@"</td></tr>"];
        if (i == [ingredients count]) {
            //IF THIS IS THE LAST INGREDIENT, CLOSE THE TABLE
            increments = [increments stringByAppendingFormat:@"</table>"];
        }
    }
    
    NSLog(@"CODE:: %@", increments);
    
    if ([MFMailComposeViewController canSendMail]) {
        [composer setToRecipients:[NSArray arrayWithObjects:@"123@abc.com", nil]];
        [composer setSubject:@"subject here"];
        [composer setMessageBody:increments isHTML:YES];
        [composer setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
        [self presentModalViewController:composer animated:YES];
        [composer release];
    }else {
        [composer release];
        }
    }
    

    This one was a huge step for me and it is actually very useful if you want to create interesting (basic) tools in your app.
    Thanks to everyone in this quintessential website for objective-c programmers.

    Andthis is the result you get. Simple but a good way to start.

    enter image description here

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

Sidebar

Related Questions

Let me try to explain what I need. I have a server that is
Pardon me if the subject question doesn't make sense and let me try to
Let's say I do something in Java like: RemoteResponse response = null; try {
OKay, I will try to make this make sense lol. Basically I have 4
Not sure if the question is titled clearly, but here goes. I have some
I frequently use Moose to make sure my data have suitable default values, like
To make my question more concrete, let me pose it as a problem: situation
Let me try to explain it. Please tell me if I am wrong. I
There's a lot of conflicting information about this topic. So let's try to agree
WCF service has one method ( Let's say TestMethod) in which I try to

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.