Domanda

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?

È stato utile?

Soluzione

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).

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top