Search code examples
iphoneobjective-cxcodecopynslog

How to nslog - copied text in iPhone?


Suppose - User has selected & copied some text in textField/textView/webView.

Now I want to Log the copied text, But don't know how?

How is it possible?

Sagar


Solution

  • UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
    
    if ([pasteboard containsPasteboardTypes: [NSArray arrayWithObject:@"public.utf8-plain-text"]]) {
        NSLog(@"WE gots a string which is: %@", pasteboard.string);
    }
    

    Hope this help! ;)