Hi

I can't get the code converted to c#, I am trying to put html content into
the clipboard so I can paste it into the mail program on the iOS device.

Please help I have been struggling for weeks. If you know of a solution
would be great for iOS4 and iOS 5.

Thank you




NSLog(@"Place HTML on the pasteboard");

UIPasteboard* pasteboard = [UIPasteboard generalPasteboard];
NSString *htmlType = @"Apple Web Archive pasteboard type";

// example html string
NSString* htmlString = @"<p style=\"color:gray\"> 
@\"http://itunes.apple.com/gb/app/paragraft/id412998778?mt=8\"; Paragraft
<br><em>Less than a word processor, more than plain text</em>";

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/

--
View this message in context: 
http://monotouch.2284126.n4.nabble.com/copy-html-into-clipboard-to-paste-into-mail-program-tp4623095.html
Sent from the MonoTouch mailing list archive at Nabble.com.
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to