uipasteboard

Named UIPasteboard between apps?

微笑、不失礼 提交于 2019-11-29 00:15:13
Is it possible to use a named UIPasteboard (ie, not the global one) to transfer data between two apps? the apps are completely independent of each other, so have different bundle IDs from different vendors I'd like to use a named pasteboard, so the user's own content in the global pasteboard is not overwritten Apple's docs say: Pasteboards may be public or private. Public pasteboards are called system pasteboards; private pasteboards are created by applications, and hence are called application pasteboards. The implication is that a pasteboard can be either "global and public" or "named and

How to copy text to clipboard/pasteboard with Swift

你离开我真会死。 提交于 2019-11-28 16:07:49
I'm looking for a clean example of how to copy text to iOS clipboard that can then be used/pasted in other apps. The benefit of this function is that the text can be copied quickly, without the standard text highlighting functions of the traditional text copying. I am assuming that the key classes are in UIPasteboard , but can't find the relevant areas in the code example they supply . If all you want is plain text, you can just use the string property . It's both readable and writable: // write to clipboard UIPasteboard.general.string = "Hello world" // read from clipboard let content =

Paste Formatted Text, Not Images or HTML

亡梦爱人 提交于 2019-11-28 13:54:27
I am trying to emulate the pasteboard behavior of the iOS Pages and Keynote apps. In short, allowing basic NSAttributedString text formatting (i.e. BIU) to be pasted into a UITextView, but not images, HTML, etc. BEHAVIOR SUMMARY If you copy formatted text from the Notes app, Evernote, or text and images from a web site, Pages will only paste the plain text string If you copy formatted text from within Pages or Keynote, it will paste the formatted text elsewhere in Pages, Keynote, etc. An undesired consequence, but perhaps important to acknowledge, is that neither Notes app or Evernote will

Allow Full Access check in keyboards iOS10

你。 提交于 2019-11-28 09:28:20
Recently iOS has an update of iOS 10 & there are certain changes for developers one of the change is now we can't check allow full access the way we did previously is given below -(BOOL)isOpenAccessGranted{ return [UIPasteboard generalPasteboard]; } I searched the latest Developer Guide for UIPasteboard , but was unable to solve it. Did any one has a proper solution for this. iOS11 and above is easy. iOS10 Solution: Check all the copy-able types, if one of them is available, you have full access otherwise not. -- Swift 4.2-- override var hasFullAccess: Bool { if #available(iOS 11.0, *){ return

iOS: How to copy HTML into the cut-paste buffer?

放肆的年华 提交于 2019-11-28 07:04:48
I'm interested in letting my users copy the text they've entered into the cut-and-paste buffer, but I'd like to do that as HTML. Is such a thing even possible? Or do I need to use a MIME format? (I have no idea.) Thanks. Obliquely 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 stackoverflow post - follow up the links there for more background. NSLog(

Named UIPasteboard between apps?

十年热恋 提交于 2019-11-27 21:26:13
问题 Is it possible to use a named UIPasteboard (ie, not the global one) to transfer data between two apps? the apps are completely independent of each other, so have different bundle IDs from different vendors I'd like to use a named pasteboard, so the user's own content in the global pasteboard is not overwritten Apple's docs say: Pasteboards may be public or private. Public pasteboards are called system pasteboards; private pasteboards are created by applications, and hence are called

Paste Formatted Text, Not Images or HTML

穿精又带淫゛_ 提交于 2019-11-27 19:30:38
问题 I am trying to emulate the pasteboard behavior of the iOS Pages and Keynote apps. In short, allowing basic NSAttributedString text formatting (i.e. BIU) to be pasted into a UITextView, but not images, HTML, etc. BEHAVIOR SUMMARY If you copy formatted text from the Notes app, Evernote, or text and images from a web site, Pages will only paste the plain text string If you copy formatted text from within Pages or Keynote, it will paste the formatted text elsewhere in Pages, Keynote, etc. An

Copy NSAttributedString in UIPasteBoard

坚强是说给别人听的谎言 提交于 2019-11-27 04:52:59
How do you copy an NSAttributedString in the pasteboard , to allow the user to paste, or to paste programmatically (with - (void)paste:(id)sender , from UIResponderStandardEditActions protocol). I tried: UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard]; [pasteBoard setValue:attributedString forPasteboardType:(NSString *)kUTTypeRTF]; but this crash with: -[UIPasteboard setValue:forPasteboardType:]: value is not a valid property list type' which is to be expected, because NSAttributedString is not a property list value. If the user paste the content of the pasteboard in my app, I

Copy NSAttributedString in UIPasteBoard

一笑奈何 提交于 2019-11-26 11:18:38
问题 How do you copy an NSAttributedString in the pasteboard , to allow the user to paste, or to paste programmatically (with - (void)paste:(id)sender , from UIResponderStandardEditActions protocol). I tried: UIPasteboard *pasteBoard = [UIPasteboard generalPasteboard]; [pasteBoard setValue:attributedString forPasteboardType:(NSString *)kUTTypeRTF]; but this crash with: -[UIPasteboard setValue:forPasteboardType:]: value is not a valid property list type\' which is to be expected, because