美文网首页
UITextView 禁止菜单

UITextView 禁止菜单

作者: cobbly | 来源:发表于2018-10-09 17:19 被阅读0次
    //! 禁止菜单 / 禁止某一个功能
      UITextView *textView = [[UITextView alloc] initWithFrame:CGRectMake(100, 100, 300, 100)];
      [self.view addSubview:textView];
      textView.editable = NO;
      textView.text = @"我的我的我的我的我的我的我的我的我的我的我的我的我的我的";
      textView.selectable = NO;
    
    - (BOOL)canPerformAction:(SEL)action withSender:(id)sender {
      if (action == @selector(copy:) || action == @selector(selectAll:) || action == @selector(paste:))
        return NO;
      return [super canPerformAction:action withSender:sender];
    }
    

    相关文章

      网友评论

          本文标题:UITextView 禁止菜单

          本文链接:https://www.haomeiwen.com/subject/gfdyaftx.html