uipasteboard

How to clear/empty pasteboard on viewWillDisappear

做~自己de王妃 提交于 2019-12-18 04:55:17
问题 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:@""]){

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

Copy Text with Formatting - iOS 6 NSAttributedString to Pasteboard

拟墨画扇 提交于 2019-12-12 07:16:34
问题 How can I programmatically copy formatted text (e.g. italic ) from a UITextView, so that when pasted into another program (e.g. Mail) the formatting will be retained? I'm assuming the correct approach is to copy an NSAttributedString to the pasteboard. Right now, I am able to copy a regular string to the pasteboard via the following: NSString *noteTitleAndBody = [NSString stringWithFormat:@"%@\n%@", [document title], [document body]]; UIPasteboard *pasteboard = [UIPasteboard generalPasteboard

UIPasteboard security

老子叫甜甜 提交于 2019-12-12 04:45:27
问题 I need to store information on application that always need to be read when open application. But I don't want user copy/dump/or edit it. So the question is : "Is UIPasteboard can solve this problem?" is it security? and if not, what else is suitable to use. Thank you very much. Edit: Is there have other solution that can solve "delete and reinstall application?" 回答1: UIPasteboard can be overwritten at any time, and I wouldn't call it secure. You might want to consider encrypting and

How do you copy a string onto the clipboard (Pasteboard) in iOS?

旧城冷巷雨未停 提交于 2019-12-12 02:59:58
问题 How do you copy a string onto the clipboard in iOS? I searched for "clipboard" in the docs, and got no hits. 回答1: Like this: [UIPasteboard generalPasteboard].string = @"hello!"; Apple doesn't use the term "clipboard"; in iOS it's a "pasteboard", and you can have more than one of them. 回答2: In Swift 3.0 below code will help to copy text on PasteBoard let pasteBoard = UIPasteboard.general pasteBoard.string = "Lorem Ipsum" 来源: https://stackoverflow.com/questions/13054014/how-do-you-copy-a-string

How can I edit the text copied into UIPasteboard

こ雲淡風輕ζ 提交于 2019-12-12 02:52:53
问题 I am trying to manipulate the text the user copied from a UILabel into the UIPasteboard but can't find an example. 回答1: Here is a full sample view controller for what you are trying to achieve (read the comments to understand what is going on...): import UIKit import MobileCoreServices class ViewController: UIViewController { override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) // add an observer (self) for whenever the pasteboard contents change // this is going to

Paste from unique PasteBoard (app-specific pasteboard)

旧时模样 提交于 2019-12-12 02:35:35
问题 Im Saving to a unique pasteboard here: UIPasteboard *pasteboard = [UIPasteboard pasteboardWithName:@"myPasteboard" create:YES]; [pasteboard setPersistent:YES]; //save to unique pasteboard [pasteboard setString: [NSString stringWithFormat:@"%@",self.myTextFieldHere]]; Trying to read it out here: UIPasteboard *pasteSaved = [UIPasteboard pasteboardWithName:@"myPasteboard"]; _myTextFieldHere.text = [pasteSaved string]; My error is "no class method for selector" for my local variable of pastesaved

UIPastboard is not working in iOS 7?

大憨熊 提交于 2019-12-11 21:08:25
问题 I am working on a iOS application in which I have to share some data between two applications and I am using UIPastboard and data is sharing successfully in iOS below 7.0 but not working in iOS 7. Here is the code I am using: // Code for writing .... Used in application "A" NSString * name = @"peter"; NSNumber *age = [NSNumber numberWithInteger:[@"33" integerValue]]; NSMutableDictionary * dict =[[NSMutableDictionary alloc]init]; [dict setObject:name forKey:@"name"]; [dict setObject:age forKey

UIPasteboard returns nil in the background

久未见 提交于 2019-12-11 15:57:10
问题 I am trying to read the Pasteboard for 5 times in the applicatioDidEnterBackground section of the AppDelegate. To print the string I use print(UIPasteboard.general.string!) but it works only into the function and it doesn't in the other nested functions. Let me explain: func applicationDidEnterBackground(_ application: UIApplication) { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application

Why does the UIPasteboard ignore the image orientation I use?

限于喜欢 提交于 2019-12-11 11:32:49
问题 I am taking an image from the camera, and rotating it to a new orientation, and then pasting it onto the general pasteboard. However, no matter what I pass in to orientation, what ends up being pasted later by the pasteboard paste command is oriented as if it were UIImageOrientationUp. CGImageRef croppedImageRef = CGImageCreateWithImageInRect([self CGImage], CGRectMake(rect.origin.y, [self size].width - rect.origin.x - rect.size.width, rect.size.height, rect.size.width)); UIImage