pasteboard

Android - Copy image to clipboard, anyone got this working?

风格不统一 提交于 2020-01-03 02:57:30
问题 I am trying to copy a image file from my apk to the clipboard. Here is how I am approaching it (roughly, i'm using a content provider locally which is out of the scope of the question. ClipboardManager mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ContentValues values = new ContentValues(2); values.put(MediaStore.Images.Media.MIME_TYPE, "Image/jpg"); values.put(MediaStore.Images.Media.DATA, filename.getAbsolutePath()); ContentResolver theContent =

iOS copy multiple images to pasteboard

大兔子大兔子 提交于 2019-12-21 21:43:47
问题 I can copy one image to the pasteboard like so: UIPasteboard *pasteboard; pasteboard = [UIPasteboard generalPasteboard]; UIImage *image; [pasteboard setImage:image]; How can I copy two or three images to the pasteboard? 回答1: [[UIPasteboard generalPasteboard] setImages:[NSArray arrayWithObjects:firstImage, secondImage, nil]]; I think this is all you're looking for. It is also possible to set a single image with multiple types (PNG, JPG, etc.) so that it is more likely that another application

Copy NSAttributedString to pasteboard

冷暖自知 提交于 2019-12-17 19:42:57
问题 Brand new to Cocoa and I'm trying to figure out how to copy an NSAttributedString to the pasteboard. I've looked in the docs and not sure if I'm supposed to use a NSPasteboardItem or not. Here's what I have to copy a regular NSString: NSPasteboard *pb = [NSPasteboard generalPasteboard]; NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil]; [pb declareTypes:types owner:self]; [pb setString:@"asdfasdf" forType:NSStringPboardType]; How do I set a NSAttributedString? Thanks 回答1:

iOS - UIPasteboard not working outside app

跟風遠走 提交于 2019-12-12 08:48:43
问题 I think this is more of an SDK flaw than my apps' but recently I've been trying to use UIPasteboard to copy strings from my app and it works fine to pasting somewhere when I'm inside the app. When I jump to another app by either pressing the home button or anything like that, I simply don't have the option to paste the copied content. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setString: @"blah" ]; NSLog(@"%@", pasteboard.string); It will print "blah" in this

Android - Copy image to clipboard, anyone got this working?

馋奶兔 提交于 2019-12-07 06:02:26
I am trying to copy a image file from my apk to the clipboard. Here is how I am approaching it (roughly, i'm using a content provider locally which is out of the scope of the question. ClipboardManager mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); ContentValues values = new ContentValues(2); values.put(MediaStore.Images.Media.MIME_TYPE, "Image/jpg"); values.put(MediaStore.Images.Media.DATA, filename.getAbsolutePath()); ContentResolver theContent = getContentResolver(); Uri imageUri = theContent.insert(MediaStore.Images.Media.INTERNAL_CONTENT_URI, values);

iOS - UIPasteboard not working outside app

牧云@^-^@ 提交于 2019-12-04 06:19:53
I think this is more of an SDK flaw than my apps' but recently I've been trying to use UIPasteboard to copy strings from my app and it works fine to pasting somewhere when I'm inside the app. When I jump to another app by either pressing the home button or anything like that, I simply don't have the option to paste the copied content. UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; [pasteboard setString: @"blah" ]; NSLog(@"%@", pasteboard.string); It will print "blah" in this case, and whenever I quick touch a textfield, it will show the paste option. But if I go to Safari, Notes

How to get HTML data out of of the OS X pasteboard / clipboard?

纵然是瞬间 提交于 2019-12-03 09:32:54
问题 I do have to send a report regarding pasting some clipboard content into a web rich editor and I need a way to dump/restore the clipboard content to (probably) HTML. How can I do this? It seems that pbcopy / pbpaste do alway give me text even if I use the pbpaste -P rtf or pbpaste -P HTML 回答1: Three years later, in more civilized times, we have Swift. You can write a short Swift script to pull exactly what you need off of OS X's pasteboard. Put the following Swift 4 snippet into a new text

Writing a string to NSPasteBoard

拈花ヽ惹草 提交于 2019-12-03 05:43:35
问题 I cannot get this method to return YES: - (BOOL) writeToPasteBoard:(NSString *)stringToWrite { return [pasteBoard setString:stringToWrite forType:NSStringPboardType]; } I have verified that stringToWrite is coming through properly, the method just always returns NO. Any ideas? Here is the rest of the class: @interface ClipBoard : NSObject { NSPasteboard *pasteBoard; } - (BOOL) writeToPasteBoard:(NSString *)stringToWrite; - (NSString *) readFromPasteBoard; @end @implementation ClipBoard - (id)

How to get HTML data out of of the OS X pasteboard / clipboard?

∥☆過路亽.° 提交于 2019-12-02 23:49:55
I do have to send a report regarding pasting some clipboard content into a web rich editor and I need a way to dump/restore the clipboard content to (probably) HTML. How can I do this? It seems that pbcopy / pbpaste do alway give me text even if I use the pbpaste -P rtf or pbpaste -P HTML chbrown Three years later, in more civilized times, we have Swift . You can write a short Swift script to pull exactly what you need off of OS X's pasteboard. Put the following Swift 4 snippet into a new text file. I named mine pbpaste.swift : import Cocoa let type = NSPasteboard.PasteboardType.html if let

Writing a string to NSPasteBoard

元气小坏坏 提交于 2019-12-02 19:03:56
I cannot get this method to return YES: - (BOOL) writeToPasteBoard:(NSString *)stringToWrite { return [pasteBoard setString:stringToWrite forType:NSStringPboardType]; } I have verified that stringToWrite is coming through properly, the method just always returns NO. Any ideas? Here is the rest of the class: @interface ClipBoard : NSObject { NSPasteboard *pasteBoard; } - (BOOL) writeToPasteBoard:(NSString *)stringToWrite; - (NSString *) readFromPasteBoard; @end @implementation ClipBoard - (id) init { [super init]; pasteBoard = [NSPasteboard generalPasteboard]; return self; } - (BOOL)