I am writing a cocoa app. I have a hidden custom View. I want to make it visible by clicking show and I want to hide it by clicking hide. My idea was to make it like in a window.
my code:
- (IBAction)show:(id)sender {
[customView makeKeyAndOrderFront:self];
}
- (IBAction)hide:(id)sender {
[customView close];
}
It does not work for me. How can I do it?
You’re using the show and close methods of an
NSWindow– that is wrong.Maybe you’re looking for
NSView‘s-setHidden:YESand-setHidden:NOinstead, which hides the NSView (inside its window).