开发者

Cocoa/Obj-C - How to set a disabled NSTextField scrollable?

I have an NSTe开发者_如何转开发xtField which is "read only" (not enabled, selectable nor editable). This field is multi-line but I would like to scroll it, is it possible?

How can I achieve this?


The usual thing to do is make it selectable but not editable. When do you want it to scroll?


In the interface builder you can set the behavior of your field. Set it to "none"


NSTextFields don't have an enclosing scroll view, generally; the user has to drag-select to scroll.

Would an NSTextView (with enclosing scroll view) work?

Otherwise, you could add some logic to resize the text field (and possibly the window) when the string is too big, but that's obviously a bit more complicated.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜