vitoziv / VIClipboardListener

Receive clipboard data, when the application is running in the background
2 stars 1 forks source link

VIClipboardListener

Listening clipboard ten minutes, when the application is running in the background

HOW TO USE

EXAMPLE

  1. Start Listener.
    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
        [[VIClipboardListener share] setDelegate:self];
        [[VIClipboardListener share] startListener];
    }
    
  2. Get pasteboard data when you copy something.
    - (void)pasteboardChanged:(UIPasteboard *)generatePasteboard {
        //Get pasteboard's String/URL/Image/Color
        //And save the data or do anything else...
        NSLog(@"The pasteboard string :%@",[UIPasteboard generalPasteboard].string);
        NSLog(@"The pasteboard URL :%@",[UIPasteboard generalPasteboard].URL);
        NSLog(@"The pasteboard image :%@",[UIPasteboard generalPasteboard].image);
        NSLog(@"The pasteboard color :%@",[UIPasteboard generalPasteboard].color);
    }