如何处理复制:粘贴:剪切:UIWebView 中的事件?正如苹果所说,我们不能继承 UIWebView,那么我该如何处理 UIResponderStandardEditActions?也许有人面临这样的困难......
我需要实现自定义复制、剪切、粘贴以复制/粘贴 html(RTF 文本、一些自定义 html 元素)。此外,我有 2 个 webview,所以如果我将一些元素粘贴到一个中,另一个应该回复此交互。
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.