1

Can I disable cut/copy in an iPhone application that displays some text via a label or what not? This data is purchased and I don't want them passing it around.

Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
  • 1
    If your security system relies on plaintext not being copied, then you should probably be worrying about more serious considerations... –  Jul 27 '13 at 16:26
  • This isnt sensitive data, just data that if passed around someway, the other users wouldnt have to purchase the application, just have a single guy send them information by copying and pasting. – Mike Flynn Jul 27 '13 at 16:32
  • That's exactly why it **is** sensitive data. –  Jul 27 '13 at 16:35
  • You can follow this link : [Disable paste in Textbox]:http://stackoverflow.com/questions/15745824/uitextfield-how-to-disable-the-paste or [Disable paste in uiwebview]:http://stackoverflow.com/questions/5995210/disabling-user-selection-in-uiwebview – Chaitali Jain Jul 27 '13 at 16:36
  • When I say sensitive, its not social security numbers or credit card numbers, its non-personal data. – Mike Flynn Jul 27 '13 at 18:10
  • Looks like I can disable screenshot, http://tumblr.jeremyjohnstone.com/post/38503925370/how-to-detect-screenshots-on-ios-like-snapchat – Mike Flynn Jul 27 '13 at 18:14

1 Answers1

2

Really you should solve this some other way. What's stopping a user from simply writing down the text? But, for the sake of answering the question:

For a UITextView override the canBecomeFirstResponder function:

- (BOOL)canBecomeFirstResponder {
    return NO;
}

And for a UITextField override canPerformAction:withSender:

- (BOOL)canPerformAction:(SEL)action withSender:(id)sender
{
    if (action == @selector(paste:))
        return NO;
    return [super canPerformAction:action withSender:sender];
}
Imirak
  • 1,323
  • 11
  • 21