uipasteboard

Copy Image with UIPasteBoard (Swift)

被刻印的时光 ゝ 提交于 2019-12-03 00:36:55
I recently saw this project in which a user can tap on a GIF from a custom keyboard and they would see a "copied" toolip appear. I have one question: How does one reproduce this tooltip in the products GIF-Tutorial ? Could anyone give me some sample code to work with. I understand how to use UIPasteboard and it's functions, but I can't seem to get it to work when I put in the UTI type "public.png" in this function: (I noticed in Objective-c it's "@public.png", but I placed "public.png" I couldn't find a source online for this) let imageURL = NSString(string:NSBundle.mainBundle()

Copy functionality in iOS by using UIPasteboard

人走茶凉 提交于 2019-12-02 19:58:46
NSString *copyStringverse = [[NSString alloc] initWithFormat:@"%@",[textview.text]]; UIPasteboard *pb = [UIPasteboard generalPasteboard]; [pb setString:copyStringverse]; I am using above code for copying contents in textview ,but I want to copy contents in a cell of the table. How to do this. Thanks in advance. Well you don't say exactly how you have your table view cell set up, but if it's just text inside your table view it could be as easy as: // provided you actually have your table view cell NSString *copyStringverse = yourSelectedOrClickedTableViewCell.textLabel.text; UIPasteboard *pb =

UIPasteboard size

廉价感情. 提交于 2019-12-01 06:46:11
问题 this is no longer relevant since iOS4+ - so please stop downvoting! or at least explain your downvotes I am trying to do an upgrade path for a lite to full version of an application, that can store an indefinite amount of data (I dont want to do in app purchase). I would like to be able to upgrade using a custom url without needing an online presence to cache the data to. So was thinking of using a UIPasteboard object. Does anyone know, or done any investigations on the max possible size of

Storing NSArray in UIPasteboard

烈酒焚心 提交于 2019-12-01 05:47:00
I have several text files which I want to transfer between 2 Apps. (ie. free and paid versions of the same App). I'm using UIPasteboard to do this. The contents of the files are held in memory as NSArrays, and so I want to copy these NSArrays to the pasteboard (lite version), and read them from the pasteboard (full version). For some reason the data cannot be read back from the pasteboard. The data is being returned as a NSData object, rather than NSArray, which I think means that it is not in the required format for the pasteboard type I am using, which is "public.utf8-plain-text". When I

Sharing File Data Between Applications in Swift/iOS [duplicate]

左心房为你撑大大i 提交于 2019-12-01 04:00:36
This question already has an answer here: Sharing data in between apps in IOS 1 answer I've been doing research on how to share data between applications securely. I'd like to get some info on the correct way to handle this before I do a deep dive on implementation using the wrong method. Just cause you can do something does not necessarily mean you should. User Case : I am working on a suite of language learning apps that have a shared audio file base of several hundred audio files and json files containing important data corresponding to a language. I'd prefer to allow the user to not have

Sharing File Data Between Applications in Swift/iOS [duplicate]

只愿长相守 提交于 2019-12-01 01:49:06
问题 This question already has an answer here : Sharing data in between apps in IOS (1 answer) Closed 3 years ago . I've been doing research on how to share data between applications securely. I'd like to get some info on the correct way to handle this before I do a deep dive on implementation using the wrong method. Just cause you can do something does not necessarily mean you should. User Case : I am working on a suite of language learning apps that have a shared audio file base of several

Copying and pasting image into a textbook in simulator

蓝咒 提交于 2019-11-30 10:28:09
I'm manually setting the copied content in the pasteboard @IBAction func onOkPressed( button: UIButton ) { var testImage = getImageWithColor(UIColor.redColor(), size: CGSize(width: 100, height: 100)); UIPasteboard.generalPasteboard().image = testImage } func getImageWithColor(color: UIColor, size: CGSize) -> UIImage { UIGraphicsBeginImageContextWithOptions(size, false, 0) color.setFill() UIRectFill(CGRectMake(0, 0, 100, 100)) var image = UIGraphicsGetImageFromCurrentImageContext() UIGraphicsEndImageContext() return image } But when I paste the image into a textbox in simulator it doest not

How to copy text to clipboard/pasteboard with Swift

南笙酒味 提交于 2019-11-30 06:14:23
问题 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. 回答1: If all you want is plain text, you can just use the string property. It's both readable and writable: //

Copying and pasting image into a textbook in simulator

老子叫甜甜 提交于 2019-11-29 15:31:48
问题 I'm manually setting the copied content in the pasteboard @IBAction func onOkPressed( button: UIButton ) { var testImage = getImageWithColor(UIColor.redColor(), size: CGSize(width: 100, height: 100)); UIPasteboard.generalPasteboard().image = testImage } func getImageWithColor(color: UIColor, size: CGSize) -> UIImage { UIGraphicsBeginImageContextWithOptions(size, false, 0) color.setFill() UIRectFill(CGRectMake(0, 0, 100, 100)) var image = UIGraphicsGetImageFromCurrentImageContext()

How to clear/empty pasteboard on viewWillDisappear

元气小坏坏 提交于 2019-11-29 07:19:46
I use UIPasteboard to copy/paste text between two UITextView . Code looks like this: - (void)viewDidLoad { [super viewDidLoad]; pasteBoard = [UIPasteboard generalPasteboard]; //it is declared in .h as UIPasteboard *pasteBoard; } -(IBAction)doCopyBtn { if (![toCopyTextView.text isEqualToString:@""]){ pasteBoard.string = toCopyTextView.text; NSLog(@"pasteb1 %@", pasteBoard.string); } else { NSLog (@"error! enter smth"); } } -(IBAction)doPasteBtn { if (![pasteBoard.string isEqualToString:@""]){ toPasteTextView.text = pasteBoard.string; NSLog(@"pasteb2 %@", pasteBoard.string); } else { NSLog (@