Search code examples
iphoneobjective-cxcodecopyuiresponder

custom Copy Responder in iphone


I have a webview in my application. I want to handle when user copies something from web view, my custom method - should be triggered. I have tried following.

I have placed following method in myViewCtr.m file

-(void)copy:(id)sender{
     NSLog(@"hi ! Hello ");
}

But nothing working - what should I do to implement the same ?


Solution

  • You need to implement -copy: on the responder, not on the controller. So you need to subclass UIWebView and override -copy:.