cocoa close NSWindow
I'm trying to make a NSWindow close when I click a button for a new NSWindow. I'm not trying to connect the button to make it close because the button is what makes it open. Or can it do both? (i am very new to xcode, please excuse me if this sounds dumb) Anyway here's my code I tried (no errors popped up or warning):
-(IBAction)switchTo:view2{
[view1 performClose:(id)view1];
}
I have 3 iboutlets ,
IBOutlet NSWindow *view1;
IBOutlet NSWindow *view2;
IBOutlet NSWindow *view3;
I have a button in view1 that opens view2, and a button in view2 that opens view3.
My only problem is when I click the button in view1 to vi开发者_如何学Cew2, I want view1 to close.
Use [view1 orderOut:nil];
instead of performClose.
You can also connect a button with two selectors. Both will be called.
精彩评论