views:

343

answers:

3
+4  A: 

No, it cannot. UIPasterBoard only accepts strings, images, URLs and colors.

FX
I was afraid someone would says this :) Thank you
ManniAT
A: 

That is not true. you can paste ANYTHING to the pasteboard, go read the docs.

I've finally put together a tutorial that shows how to copy HTML into the Mail app. http://mcmurrym.wordpress.com/2010/08/13/pasting-simplehtml-into-the-mail-app-ios/

maxpower
Could you please tell me, where in the 3.x UIPasteBoard DOCs these other ("ANYTHING") could be found?I followed your friendly suggestion and read the docs: http://developer.apple.com/iphone/library/documentation/uikit/reference/UIPasteboard_Class/Reference.html#//apple_ref/doc/uid/TP40008243-CH1-SW49 Maybe there are other docs I should read - just tell me where they are.
ManniAT
A: 

on that same link you gave in your comment, you'll find this paragraph at the top.

A Uniform Type Identifier (UTI) is frequently used for a representation type (sometimes called a pasteboard type). For example, you could use kUTTypeJPEG (a constant for public.jpeg) as a representation type for JPEG data. However, applications are free to use any string they want for a representation type; however, for application-specific data types, it is recommended that you use reverse-DNS notation to ensure the uniqueness of the type (for example, com.myCompany.myApp.myType).

Right below it is a link to here. http://developer.apple.com/iphone/library/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_intro/understand_utis_intro.html#//apple_ref/doc/uid/TP40001319

Which explains UTIs.

Finally this link gives you SEVERAL types http://developer.apple.com/iphone/library/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html#//apple_ref/doc/uid/TP40009259-SW1

Of course that list isn't ALL types as you can create your own types.

I have successfully pasted html into the mail app. I'll give you a good place to start...

Create an app that will show the data types in the pasteboard. Goto safari on the device, copy a web page. Run your app, You'll notice the pasteboard type is "Apple Web Archive pasteboard type." Note that this is really a pasteboard type (a custom one). If you try to duplicate the safari mobile copy and paste feature yourself by creating a web archive and attempt to paste it as text into the mail app, it will show the web archive file as raw xml. If you define the type as "Apple Web Archive pasteboard type" the mail app will actually format the paste as html.

If you want to know what a web archive looks like. On desktop safari, just save a web page as an archive and look at the file in a text reader (text edit will try to parse it, so you might use a different program to look at the archive xml).

Please read all of the documentation as you can discover that you can do custom types in the link that you sent me.

maxpower
The problem is (on iPhone not desktop), - as I wrote in the initial question - that when I set the type to (for an example) "Apple Web Archive pasteboard type" nothing pastes in the email. I also found the extension for UTIs - but I couldn't get it work nor did I find an example on the web. All I found (which was also the first answer here) was that "on iPhone only ... are available".
ManniAT
Ah, and by the way (sry that I forgot) thank you for your effort. If you could provide provide a link to some working sample this would be great.
ManniAT
My solution is for the iphone/ipad. I'll see if I can get around to creating an example. The problem you are running into is that the string associated with the type for Apple Web Arc.... is that it can't be just a plain string. It is a rather involved process. You need to create an XML document/string and the actual html contents within are base64 encoded. Feel free to at least take the negative vote off :) I should have given you a detailed answer initially, sorry for being short.
maxpower
I'm also working on pasting correctly into numbers for ipad which I'll see if I can get an example up for that as well, but I've just started that path so it might take a little bit of time, not sure.
maxpower