Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS如何监视剪贴板内容_Ios - Fatal编程技术网

iOS如何监视剪贴板内容

iOS如何监视剪贴板内容,ios,Ios,RT:如何监控剪贴板内容 [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addword:) name:UIPasteboardChangedNotification object:[UIPasteboard generalPasteboard]]; [[UIPasteboard generalPasteboard] addObserver:self forKeyPath:@"string" op

RT:如何监控剪贴板内容

[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(addword:) name:UIPasteboardChangedNotification object:[UIPasteboard generalPasteboard]];

[[UIPasteboard generalPasteboard] addObserver:self forKeyPath:@"string" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];

我尝试使用通知和kvo的方式来发现无法实现的问题

您将此代码放在何处
self
是一个
剪贴板
?self是viewDidLoad中的一个键盘,在我的测试发现通知在应用程序中工作,但他没有在键盘上工作(appex),我可以通过[UIPasteboard generalPasteboard].string主动获得剪切