Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't disable copy UIWebView
    primarykey
    data
    text
    <p>In my ViewController's header file I have:</p> <pre><code>@interface CaseStudyChoiceViewController : UIViewController &lt;UIWebViewDelegate&gt; @property (strong, nonatomic) IBOutlet UIWebView *myWebView; @end </code></pre> <p>Then in the .m file in the ViewDidLoad method:</p> <pre><code>[_myWebView setDelegate:self]; </code></pre> <p>and finally:</p> <pre><code>#pragma mark - WebView Delegate Methods -(BOOL)canPerformAction:(SEL)action withSender:(id)sender { if (action == @selector(copy:) || action == @selector(paste:) || action == @selector(select:) || action == @selector(cut:) || action == @selector(selectAll:)) { NSLog(@"Selector is %@", NSStringFromSelector(action)); return NO; } else { return [super canPerformAction:action withSender:sender]; } //I tried the code below as well and got the same result /* UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController) { [UIMenuController sharedMenuController].menuVisible = NO; } return NO; */ } </code></pre> <p>The problem I have is that this will <strong>NOT</strong> disable the Copy function. When I run this the NSLog output is:</p> <pre><code> 2013-12-30 21:39:28.794 PCO - CLS[45238:70b] Selector is cut: 2013-12-30 21:39:28.794 PCO - CLS[45238:70b] Selector is select: 2013-12-30 21:39:28.795 PCO - CLS[45238:70b] Selector is selectAll: 2013-12-30 21:39:28.795 PCO - CLS[45238:70b] Selector is paste: </code></pre> <p>copy: is never presented in the <em>canPerformAction</em> method. Any ideas on where I can capture it?</p> <p>The end result here is that when the user does a long touch in the UIWebView two options pop up, Copy and Define. I only want Define.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload