Reputation:
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.
Upvotes: 1
Views: 193
Reputation: 89519
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://[email protected]"]];
(details for the above can be found at http://iosdevelopertips.com/cocoa/launching-other-apps-within-an-iphone-application.html)
Upvotes: 0
Reputation: 2623
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?
Upvotes: 0
Reputation: 20236
Check out the documentation on MFMailComposeViewController
. You can present a mail compose view, user will fill it out and send the mail.
Upvotes: 2