1

How to hadle copy: paste: cut: events in UIWebView? As Apple says, we can not subclass UIWebView, so how can I handle UIResponderStandardEditActions? Maybe someone faced with such a difficulties...

I need to implement custom copy,cut,paste in order to copy/paste html (RTF text, some custom html elements). In addition, I have 2 webviews, so if I paste some elements in one, another one should reply for this interaction.

velkopopovizky
  • 148
  • 2
  • 7
  • What are you trying to accomplish with this? You could handle it differently depending on what you're doing. – woz Jul 05 '12 at 12:47

1 Answers1

1

Unfortunately, I think you are going to have to make your own copy/paste menu.

Using the answer from this question you can set up custom copy/paste buttons, and you could handle everything you are trying to do through those:

[[UIApplication sharedApplication] sendAction:@selector(cut:) to:nil from:self forEvent:nil];

Also, this question shows how to make a custom UIMenuController and use the UILongPressGestureRecognizer to get it to show up on the UIWebView.

I hope this helps. Someone else may know an easier way, but I think this way will work at least.

Community
  • 1
  • 1
woz
  • 10,888
  • 3
  • 34
  • 64
  • @Altaveron No, it doesn't cut anything; it allows you to handle cutting something using your own code. Standard cut/copy/paste is automatically provided in a `UIWebView`. – woz Nov 05 '12 at 13:29