In the MainMenu.nib window,
click on the Classes tab. If you??™re lucky, MyOpenGLView will still be
selected, if not, navigate to it and select it. Click on the Classes menu and
Create Files for MyOpenGLView item. This will prompt you to create
?¬?les for both the header and the source for this view. Accept the defaults, and
we??™ll begin laying out the view in a window.
Figure 8-4 Instantiated OpenGL View Object in Interface Builder
124 Chapter 8: The Cocoa API for OpenGL Con?¬?guration
Figure 8-5 Custom View Palette in Interface Builder
At this point, we??™ve created the necessary infrastructure, but we still have to
place our view in our window. As with most Interface Builder tasks, we accomplish
this by dragging and dropping and by applying a little customization.We
begin by dragging a Custom View into the window named Window. Go to the
Cocoa-Interfaces window (if it??™s not visible, get there by clicking the menu
Tools, the submenu Palettes, and then the item Show Palettes) and
navigate to the Custom View pane. This palette can be seen in Figure 8-5. Drag
the CustomView icon from the palette into Window and arrange it as shown in
Figure 8-6.
The ?¬?nal step in this setup operation is to change the CustomView to be your
MyOpenGLView object. To do so, open the Inspector (if it??™s not open, click
Figure 8-6 Adding a Custom View to a Window in Interface Builder
NSOpenGLView 125
Figure 8-7 Binding a Custom View to the NSOpenGLView Subclass Object
the Tools menu and Show Info item) and click on the CustomView you
just dragged into place.
Pages:
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213