【问题标题】:How to know when paste event triggered in UITextView?如何知道何时在 UITextView 中触发了粘贴事件?
【发布时间】:2013-10-03 10:32:56
【问题描述】:

我一直在 IOS 中开发富文本编辑器应用程序。

我的目的是检测UITextView中Paste事件的触发,并阻止默认的粘贴操作。然后,我会将UIPasteboard 中的内容转换为我的编辑器应用格式,并将转换后的nsattributedstring 附加到UITextView

我参考了以下链接:

Detect when a user clicks the paste button in a UITextView.

我认为问题的解决方案与UITextField 相关,而不是UITextView(请纠正我,如果我错了)。

感谢您的回答。

【问题讨论】:

    标签: iphone ios uitextview uipasteboard


    【解决方案1】:

    我认为创建自定义文本视图并覆盖粘贴:方法会对您有所帮助。

    - (void)paste:(id)sender
    {
        [super paste:sender];
    
        NSLog(@"PASTE!!");
    }
    

    【讨论】:

    猜你喜欢
    • 2012-09-09
    • 1970-01-01
    • 2012-01-23
    • 2016-09-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多