Skip to content

Instantly share code, notes, and snippets.

@colbylwilliams
Created January 13, 2016 20:29
Show Gist options
  • Save colbylwilliams/87dfab1ea4fb302ecaa7 to your computer and use it in GitHub Desktop.
Save colbylwilliams/87dfab1ea4fb302ecaa7 to your computer and use it in GitHub Desktop.
UIWebView subclass that only displays Copy & Paste
using Foundation;
using UIKit;
using CoreGraphics;
using ObjCRuntime;
using MobileCoreServices;
namespace WebViewExample.iOS
{
public class CustomWebView : UIWebView
{
public CustomWebView (CGRect frame) : base(frame)
{
}
public override bool CanPerform (Selector action, NSObject withSender)
{
return action.Name.Equals("copy:") || (action.Name.Equals("paste:") && UIPasteboard.General.Contains(new string[] { UTType.Text }));
}
}
}
@sarkarjayanta
Copy link

it's does not work still all menu comes (copy, paste, define, select etc.).

@sarkarjayanta
Copy link

hi any update on above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment