UIActivityViewController with HTML

后端 未结 4 1066
一生所求
一生所求 2021-02-01 22:16

When I pass a string containing HTML content as an array element to the UIActivityViewController initWithActivityItems method it doesn\'t present it as HTML in the

4条回答
  •  故里飘歌
    2021-02-01 23:06

    In my testing if the string begins "" and ends "" then it is treated as HTML.

    If you want a good result with the non-HTML-aware sharing services you need to instead use an object that implements the UIActivityItemSource protocol and returns the HTML string when from -activityViewControllerPlaceholderItem: and from -activityViewController:itemForActivityType: if the activity is UIActivityTypeMail and nil otherwise.

    A second UIActivityItemSource that returns a suitable non-HTML string from -activityViewControllerPlaceholderItem: and from -activityViewController:itemForActivityType: if the activity is not UIActivityTypeMail (and nil if it is) is the rest of the puzzle.

    I recommend against having one object do both jobs, as the UIActivity engine is entitled to make different decisions based on whether the placeholder item appears to be HTML or not.

提交回复
热议问题