Objective c 创建第二个窗口
嗨,我想在第二个窗口中运行OpenGlView。我可以打开这个“simualtion”窗口,但没有什么可看的,这是我在Interface Builder中创建的。我认为问题在于我创建了一个全新的窗口。我试着这样做,因为我想用同样的方法关闭旧窗口并打开新窗口,因为我只想使用一个按钮。 因此,我希望您能告诉我如何从IB链接窗口。 我试着这样做,因为我想用同样的方法关闭旧窗口并打开新窗口,因为我只想使用一个按钮Objective c 创建第二个窗口,objective-c,cocoa,xcode,interface-builder,nswindow,Objective C,Cocoa,Xcode,Interface Builder,Nswindow,嗨,我想在第二个窗口中运行OpenGlView。我可以打开这个“simualtion”窗口,但没有什么可看的,这是我在Interface Builder中创建的。我认为问题在于我创建了一个全新的窗口。我试着这样做,因为我想用同样的方法关闭旧窗口并打开新窗口,因为我只想使用一个按钮。 因此,我希望您能告诉我如何从IB链接窗口。 我试着这样做,因为我想用同样的方法关闭旧窗口并打开新窗口,因为我只想使用一个按钮 simulation = window = [[NSWindow alloc] init
simulation = window = [[NSWindow alloc] initWithContentRect:NSMakeRect(100,100,700,700)
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
[simulation makeKeyAndOrderFront:NSApp];
嘿,伙计们,我发现了问题所在: 在界面中:
#import <Cocoa/Cocoa.h>
@interface new_WatorAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
NSWindow *simulation;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSWindow *simulation;
-(IBAction)runSimulation:(id)sender;
@end
嘿,伙计们,我发现了问题所在: 在界面中:
#import <Cocoa/Cocoa.h>
@interface new_WatorAppDelegate : NSObject <NSApplicationDelegate> {
NSWindow *window;
NSWindow *simulation;
}
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet NSWindow *simulation;
-(IBAction)runSimulation:(id)sender;
@end
实际描述解决方案:从在代码中创建窗口(不在其中放入任何视图)切换到在IB中创建窗口(和视图)。实际描述解决方案:从在代码中创建窗口(不在其中放入任何视图)切换到在IB中创建窗口(和视图)。