Question

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?

Was it helpful?

Solution

You're using the show and close methods of an NSWindow - that is wrong. Maybe you're looking for NSView's -setHidden:YES and -setHidden:NO instead, which hides the NSView (inside its window).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top