Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The following code will get your HTML out of your app and into Apple's Mail app. The documentation doesn't give you a great deal of help on this, so in part it's a matter of looking at what Apple's apps park on the pasteboard and then reverse engineering that. This solution draws on an earlier <a href="https://stackoverflow.com/questions/2438759/copy-html-to-uipasteboard">stackoverflow post</a> - follow up the links there for more background.</p> <pre><code>NSLog(@"Place HTML on the pasteboard"); UIPasteboard* pasteboard = [UIPasteboard generalPasteboard]; NSString *htmlType = @"Apple Web Archive pasteboard type"; // example html string NSString* htmlString = @"&lt;p style=\"color:gray\"&gt; &lt;a href=@\"http://itunes.apple.com/gb/app/paragraft/id412998778?mt=8\"&gt;Paragraft&lt;/a&gt;&lt;br&gt;&lt;em&gt;Less than a word processor, more than plain text&lt;/em&gt;"; NSMutableDictionary *resourceDictionary = [NSMutableDictionary dictionary]; [resourceDictionary setObject:[htmlString dataUsingEncoding:NSUTF8StringEncoding] forKey:@"WebResourceData"]; [resourceDictionary setObject:@"" forKey:@"WebResourceFrameName"]; [resourceDictionary setObject:@"text/html" forKey:@"WebResourceMIMEType"]; [resourceDictionary setObject:@"UTF-8" forKey:@"WebResourceTextEncodingName"]; [resourceDictionary setObject:@"about:blank" forKey:@"WebResourceURL"]; NSDictionary *containerDictionary = [NSDictionary dictionaryWithObjectsAndKeys:resourceDictionary, @"WebMainResource", nil]; NSDictionary *htmlItem = [NSDictionary dictionaryWithObjectsAndKeys:containerDictionary,htmlType,nil]; [pasteboard setItems: [NSArray arrayWithObjects: htmlItem, nil]]; // This approach draws on the blog post and comments at: // http://mcmurrym.wordpress.com/2010/08/13/pasting-simplehtml-into-the-mail-app-ios/ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload