开发者

How can I add NSTextView and NSMatrix controls in a single scrollable NSScrollView?

I am new to Mac development.

I want to add three controls in a single Scrollable NSScrollView.

1) NSTextView. 2) NSMatrix. 3开发者_Python百科) NSTextView.

Please note that text in nstextview can be of dynamic height.... and there should be no scroll for textviews.

here is a screenshot of what I am looking for -

how can I add these three views in nsscrollview? Please help!

Update 1 - can I add these controls in a NSView?

How can I add NSTextView and NSMatrix controls in a single scrollable NSScrollView?


I'll assume you've got a project in Xcode 4 started. Select your project's MainMenu.xib file to begin editing your main user interface.

Start with a window. Drag a custom view into it. Add your text view to the custom view, followed by the matrix, followed by another text view, sizing the views as you go. It's at this point that you also can configure your text views not to display scroll bars. Next, select the custom view. Embed it in a scroll view, and there you are.

The window, custom view, text views, and matrix are selected from Xcode 4's Object Library palette. To embed, choose the Embed/Scroll View command from the Editor menu.

As for the dynamic sizing, you'll have to code for changing the heights of the text views, and so the height of the enclosing custom view. (That is an exercise I leave to you.) Your burden can be lessened somewhat by taking advantage of autosizing to maintain the proper spacing between the three UI elements; you can do this either in Xcode 4, or you can do it using NSView's relevant instance methods.

Good luck to you in your endeavors.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜