1

Here is the code that I have for my cell of my UITableView:

                            forKeys:[NSArray arrayWithObjects:@"Title", @"Cells", @"Footer Title", nil]] autorelease];
[tableView1CellData addObject:sectionContainer_3];
NSMutableArray *cells_4 = [[[NSMutableArray alloc] init] autorelease];
NSDictionary *cellContainer_4_1 = [[[NSDictionary alloc] initWithObjects:[NSArray arrayWithObjects:@"Support", @"", @"", @"", @"", @"1", nil]

What would I have to add so that when the cell is tapped, it happened up a MailView in the app (preferably) but I understand that the easiest way is to just use the HTML "mailto" ? I'm brand new to Objective-C, but I am able to edit C and C++, so I think that I can work in any answer. Thanks in advance!

P.S. Posting this from iPhone (just thought of asking question) so sorry if the code isn't highlighted, but i tried to space it out.

3 Answers3

2

Check out the documentation on MFMailComposeViewController. You can present a mail compose view, user will fill it out and send the mail.

jer
  • 20,094
  • 5
  • 45
  • 69
  • Using the code above, though, how would I do this? I'm confused by the documentation. Thanks. –  Apr 04 '12 at 03:51
0

And yes, you can use the mailto: URL thing... but @jer's answer is the one I would prefer to do myself, as a developer.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://info@iosdevelopertips.com"]];

(details for the above can be found at http://iosdevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215
  • Yes, this is more clear then the documentation, but how would I connect it to thr cell? –  Apr 04 '12 at 03:56
  • the code snippet you put into your question isn't detailed enough for me to figure out where you're putting your e-mail addresses or how the table view cell is being filled out. – Michael Dautermann Apr 04 '12 at 04:03
0

1.Add the Message UI Framework

2.You should have registered a delegate for the UITableView. See a UITableView tutorial if needed.

3.Implement the following method:

- (void)tableView: (UITableView *)tableView didSelectRowAtIndexPath: (NSIndexPath *) indexPath { 
    ... 
}

4.Inside the method use MFMailComposeViewController to send the email. Example usage:

MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"My Subject"];
[controller setMessageBody:@"Hello there." isHTML:NO]; 
if (controller) [self presentModalViewController:controller animated:YES];
[controller release];

Read More: How can I send mail from an iPhone application

UITableView/UITableViewCell tap event response?

Community
  • 1
  • 1
Saikat
  • 2,613
  • 1
  • 22
  • 14