I have to disable Paste option when user long press on UITextField.I have got this code but still it is not hiding Paste option.
-(BOOL)canPerformAction:(SEL)action withSender:(id)sender {
if ( [UIMenuController sharedMenuController] )
{
[UIMenuController sharedMenuController].menuVisible = NO;
}
return NO;
}
Can any one help me?
As already said in comments.. you need to “include the exact same code in a subclass of UITextField and then use instances of that class”
so.. create new file .. let’s say TestPaste.. subclass of UITextField
put your code in implementation file (TextPaste.m)
now. go to your NIB/Storyboard, click on your UITextFiled and change the textview class to your TextPaste