【问题标题】:Disable editing in NSTextView在 NSTextView 中禁用编辑
【发布时间】:2017-07-15 11:56:18
【问题描述】:

我正在尝试禁用 NSTextView 中的编辑,但那里似乎没有任何选项。所有其他类型都启用了属性,当设置为 false 时是不可编辑的,但 NSTextView 有吗?

【问题讨论】:

    标签: macos cocoa nstextview


    【解决方案1】:

    请不要忘记一个类继承了它的超类的方法。 NSTextView 的超类是 NSText。在那里你找到了方法

    • (void)setEditable:(BOOL)标志

    附注:

    Controls whether the receiver allows the user to edit its text.
    

    【讨论】:

      【解决方案2】:

      对于 SWIFT3,您需要将 isEditable 设置为 false。

      var isEditable: Bool 一个布尔值,用于控制共享接收者布局管理器的文本视图是否允许用户编辑文本。

      https://developer.apple.com/documentation/appkit/nstextview#overview

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-12-15
        • 2016-09-23
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-02-17
        • 2012-10-24
        相关资源
        最近更新 更多