How do you REALLY remove Copy from UIMenuController

后端 未结 6 1253
悲&欢浪女
悲&欢浪女 2020-12-04 22:31

There apparently used to be an easy way to prevent the \"More...\" label from appearing in UIMenuController when you added more than one custom menu item. You just had to re

6条回答
  •  再見小時候
    2020-12-04 23:05

    for ios >= 5.1 canPerformAction:(SEL)action withSender:(id)sender is not working anymore.

    If you are ok with just disable paste action here is a method:

    add UITextFieldDelegate to you view controller and implement method like this

    - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string{
    if(textField == txtEmailRe)
        return ((string.length) > 1 ? NO : YES);
    }
    

    it means that if user enter more than one character for each action (it means that probably user is pasting something.) do not accept it in textfield.

    it is a good practice for force user enter textfields like e-mail and

提交回复
热议问题