简体   繁体   中英

Copy HTML out of your app and into Apple's Mail app in iOS 5

There's a great solution that demonstrates how to copy HTML content via the UIPasteboard into Apple's Mail app here . This works up until iOS 4.2 but not with iOS 5.

In iOS 5 copying the string:

<h1><font color="red">Hello World</font></h1>

results in this output in the Mail app:

<html><head></head><body bgcolor="#FFFFFF"><h1><span class="Apple-style-span"
style="font-size: 17px; font-weight: normal;">Hello World</span></h1><div>
</div></body></html>

Any ideas how to get rid of that Apple-style-span thing and leave the HTML content as is?

Just found an explanation: http://www.ideasunplugged.com/ios-5.0-bug

Apple: "This is the expected behavior. When pasting into Mail we perform the 2-step paste. The content is pasted by stripping all the attributes that cannot be modified through the rich edit interface and the result is that you see the pasted content without colors, fonts, etc. We preserve only bold, italic and underline. If you want to have the original appearance, after paste you need to press undo. the first undo will restore all the stripped attributes, the second will remove the pasted content altogether."

The "Undo Change Attributes" does indeed work when copying from the Safari to Mail but I cannot get it working using my own app and the that method Matthew Elton describes .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM