应用程序中的多个窗口或“页面”

时间:2022-09-06 21:19:57

I am a newbie in Mac application development. I want to write a GUI application in Cocoa using Interface Builder. I want multiple screens i.e. when one button on a screen is clicked, another screen should be displayed. How can I activate a new screen at button click event?

我是Mac应用程序开发的新手。我想使用Interface Builder在Cocoa中编写GUI应用程序。我想要多个屏幕,即当点击屏幕上的一个按钮时,应该显示另一个屏幕。如何在按钮点击事件中激活新屏幕?

5 个解决方案

#1


4  

I would heartily recommend Aaron Hilegass's book Cocoa Programming for Mac OS X. It took me from feeling like everything was impossible to being relatively competent in the space of a few short weeks. I was very impressed with it.

我衷心地推荐Aaron Hilegass为Mac OS X编写的Cocoa Programming一书。我觉得在短短的几个星期里,我觉得一切都不可能相对胜任。我对它印象非常深刻。

Apple's documentation is amazingly good, but it takes a while to get used to the style, and you will need to know which objects actually exist before you can look up how to use them, which is where Aaron's book comes in.

Apple的文档非常好,但是需要一段时间才能适应这种风格,你需要知道哪些对象实际存在才能查找如何使用它们,这是Aaron的书出现的地方。

Your library may have a copy of it, or be able to order one for you if they don't.

您的图书馆可能有一份副本,或者如果他们没有,可以为您订购一本。

#2


3  

I think you mean windows, not screens. Screens are the displays (monitors) on which all the user's windows from all the user's applications appear.

我认为你的意思是窗户,而不是屏幕。屏幕是显示器(监视器),所有用户应用程序的所有用户窗口都显示在该显示器上。

And I second Jonathan's recommendation of the Hillegass book.

而我第二次是Jonathan对Hillegass书的推荐。

#3


2  

The button has a target. That should link to the new window. As its action you can tell the window to show itself.

按钮有一个目标。那应该链接到新窗口。作为它的动作,你可以告诉窗口显示自己。

Take a look at: http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html

请查看:http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html

#4


1  

I think what you want is the type of interface like that seen in Coda, or System Preferences where there is a toolbar on the top of the screen that can be used to select between the content of the window.

我想你想要的是像Coda中看到的界面类型,或者系统偏好设置,其中屏幕顶部有一个工具栏,可用于在窗口内容之间进行选择。

The simplest method I have found is to use BWToolkit.

我发现最简单的方法是使用BWToolkit。

Another method is to use a series of views, and switch between them when the toolbar is clicked. I've found one description here, but that's not the one I used first (which may have been originally in Ruby Cocoa, IIRC).

另一种方法是使用一系列视图,并在单击工具栏时在它们之间切换。我在这里找到了一个描述,但那不是我先用过的那个(最初可能是Ruby Cocoa,IIRC)。

#5


0  

NSTabView.

#1


4  

I would heartily recommend Aaron Hilegass's book Cocoa Programming for Mac OS X. It took me from feeling like everything was impossible to being relatively competent in the space of a few short weeks. I was very impressed with it.

我衷心地推荐Aaron Hilegass为Mac OS X编写的Cocoa Programming一书。我觉得在短短的几个星期里,我觉得一切都不可能相对胜任。我对它印象非常深刻。

Apple's documentation is amazingly good, but it takes a while to get used to the style, and you will need to know which objects actually exist before you can look up how to use them, which is where Aaron's book comes in.

Apple的文档非常好,但是需要一段时间才能适应这种风格,你需要知道哪些对象实际存在才能查找如何使用它们,这是Aaron的书出现的地方。

Your library may have a copy of it, or be able to order one for you if they don't.

您的图书馆可能有一份副本,或者如果他们没有,可以为您订购一本。

#2


3  

I think you mean windows, not screens. Screens are the displays (monitors) on which all the user's windows from all the user's applications appear.

我认为你的意思是窗户,而不是屏幕。屏幕是显示器(监视器),所有用户应用程序的所有用户窗口都显示在该显示器上。

And I second Jonathan's recommendation of the Hillegass book.

而我第二次是Jonathan对Hillegass书的推荐。

#3


2  

The button has a target. That should link to the new window. As its action you can tell the window to show itself.

按钮有一个目标。那应该链接到新窗口。作为它的动作,你可以告诉窗口显示自己。

Take a look at: http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html

请查看:http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/WinPanel/WinPanel.html

#4


1  

I think what you want is the type of interface like that seen in Coda, or System Preferences where there is a toolbar on the top of the screen that can be used to select between the content of the window.

我想你想要的是像Coda中看到的界面类型,或者系统偏好设置,其中屏幕顶部有一个工具栏,可用于在窗口内容之间进行选择。

The simplest method I have found is to use BWToolkit.

我发现最简单的方法是使用BWToolkit。

Another method is to use a series of views, and switch between them when the toolbar is clicked. I've found one description here, but that's not the one I used first (which may have been originally in Ruby Cocoa, IIRC).

另一种方法是使用一系列视图,并在单击工具栏时在它们之间切换。我在这里找到了一个描述,但那不是我先用过的那个(最初可能是Ruby Cocoa,IIRC)。

#5


0  

NSTabView.