Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 04-30-2009, 03:43 PM   #7 (permalink)
FlyingDiver
Former NeXTStep Developer
 
Join Date: Mar 2009
Posts: 997
FlyingDiver will become famous soon enough
Default

Quote:
Originally Posted by DenVog View Post
I did start down the HTML path, as this Nutsmuggling thread made it look easy. Which it probably is if you're just formatting static text. I can't find a way to insert a string from a variable within the HTML code though.
Hmm. The posted code is:

Code:
NSString *eMailBody = @"<table>
<tr><td style='text-align:right'><b>Name</b>:</td>
<td>John</td></tr><tr>
<td style='text-align:right'><b>Surname</b>:</td><td>Doe</td></tr>
<tr><td style='text-align:right'>
 <b>Occupation:<b/></td><td>Placeholder</td></tr></table>";

NSString *encodedBody = [eMailBody stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
NSString *urlString = [NSString stringWithFormat:@"mailto:me@me.com?subject=HiPhone&body=%@", encodedBody];
NSURL *url = [[NSURL alloc] initWithString:urlString];
[[UIApplication sharedApplication] openURL:url];
So what happens when you try something like:

Code:
NSString *eMailBodyTemplate = @"<table>
<tr><td style='text-align:right'><b>Name</b>:</td>
<td>%@</td></tr><tr>
<td style='text-align:right'><b>Surname</b>:</td><td>%@</td></tr>
<tr><td style='text-align:right'>
 <b>Occupation:<b/></td><td>%@</td></tr></table>";

NSString *eMailBody = [NSString StringWithFormat: eMailBodyTemplate, @"First Name", @"Last Name", @"Profession"];
NSString *encodedBody = [eMailBody stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; 
NSString *urlString = [NSString stringWithFormat:@"mailto:me@me.com?subject=HiPhone&body=%@", encodedBody];
NSURL *url = [[NSURL alloc] initWithString:urlString];
[[UIApplication sharedApplication] openURL:url];
You could substitute in your own string pointers in place of @"First Name", @"Last Name", @"Profession".

jow
FlyingDiver is offline   Reply With Quote
 

» Advertisements
» Online Users: 451
11 members and 440 guests
buggen, ClerurcifeDer, Droverson, fredidf, guusleijsten, kevinbertman, Kieren Harrold, mer10, PavelMik, sledzeppelin, TheStalker
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,636
Threads: 94,101
Posts: 402,820
Top Poster: BrianSlick (7,990)
Welcome to our newest member, samdanielblr
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:56 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.