Mike Flynn
Mike Flynn

Reputation: 24325

iOS disable cut/copy in iPhone

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.

Upvotes: 1

Views: 1652

Answers (1)

Imirak
Imirak

Reputation: 1333

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];
}

Upvotes: 2

Related Questions