views:

95

answers:

3

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

+4  A: 

My guess would be to use the UIPasteBoard function: http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIPasteboard_Class/Reference.html

Hope that helps!

Neurofluxation
Just because it doesn't spoonfeed you the code doesn't mean its an indirect answer. Neruofluxation is pointing you in the exact direction you need to be looking. This site isn't a place to get work done for you.
Jasarien
^.^ - Thank you Jasarien
Neurofluxation
+4  A: 

Ok, here you go Sagar... It would be wise for you to research how this works though:

This code to Copy strings to the pasteBoard:

    -(IBAction)copyStringToPasteBoard{
       UIPasteboard *appPasteBoard = [UIPasteboard pasteboardWithName:@"CopyFrom" create:YES];
       appPasteBoard.persistent = YES;
       NSString *yourCopiedText = @"YOUR TEXT HERE";
       NSLog(@"\n Your String: %@",appPasteBoard.string);
       [appPasteBoard setString:textView.text];
    }

I hope this is more specific for you, please vote me up ^.^

Neurofluxation
+3  A: 
 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! ;)

MetaImi
This one worked for me.
sugar