Search code examples
iphoneobjective-cuitableviewmfmailcomposer

email tableView text


i know how to add in app email, but i dont know how to email the text of my table view. I do, but my problem is that when the user adds a cell to the table, how do i get that to print out too? to print out the text normally i would use

string = [[NSString alloc]initWithFormat:@"%@ \n %@ \n %@",[array objectAtIndex:0], 
                                                           [array objectAtIndex:1], 
                                                           [array objectAtIndex:2]];

and i set the email Body to string. Does anyone know how to make it to where if a new cell is added, i can get it to be added to the email body as well??

Thanks


Solution

  • I'm not 100% sure I understand your problem but here goes . . .

    You can make your code deal with more than a fixed number of items like this :

    string = [array componentsJoinedByString:@" \n "];
    

    If array is also the data source for your table view then string should then contain all the table cells with a break between them.


    You can only update the body of your email in an MFMailComposeViewController before you have shown the email view to the user - once it's been displayed then it's read only :(