相关疑难解决方法(0)

在后台接收UIPasteboard(generalPasteboard)通知

有没有办法做到这一点?我UIPasteboardChangedNotification在发布时注册了我的对象,但是当它发送到后台并打开(例如)Safari并复制一些文本时,我的处理程序永远不会被调用.(我现在只使用模拟器).

我用过两个:

[[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(pasteboardNotificationReceived:) 
    name:UIPasteboardChangedNotification 
    object:[UIPasteboard generalPasteboard]];
Run Code Online (Sandbox Code Playgroud)

和:

[[NSNotificationCenter defaultCenter] addObserver:self 
    selector:@selector(pasteboardNotificationReceived:) 
    name:UIPasteboardChangedNotification 
    object:nil ];
Run Code Online (Sandbox Code Playgroud)

注册我的处理程序.

cocoa-touch uipasteboard generalpasteboard

11
推荐指数
1
解决办法
6366
查看次数