Reputation: 43
In my project,I added a extra NSWindowController namedNewWindow
.Now I want add an button to hiden/view the wimdow.My code as following.
#import "AppDelegate.h"
#import "NewWindow.h"
@interface AppDelegate ()
@property (weak) IBOutlet NSView *view;
- (IBAction)showNewWindow:(id)sender;
@end
@implementation AppDelegate
{
NewWindow *newWindow;
BOOL isNewWindowLoad;
}
-(id)init
{
self = [super init];
if(self)
{
newWindow = [[NewWindow alloc] init];
}
return self;
}
- (IBAction)showNewWindow:(id)sender
{
if(!isNewWindowLoad)
{
[newWindow loadWindow];
isNewWindowsLoad = YES;
}
else
{
[[newWindow window] close];
isNewWindowLoad = NO;
}
}
@end
the window can load,but it can't be hidden. Anyone can tell me how to do it?Through clicking the button to control the window load/hidden.
Upvotes: 0
Views: 2131
Reputation: 15623
Call orderOut
to hide the window. It's still there, you can call orderFront
or makeKeyAndOrderFront
to show it again.
Upvotes: 1