Custom View make visible an hide
-
23-06-2021 - |
문제
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:YES
and -setHidden:NO
instead, which hides the NSView (inside its window).
제휴하지 않습니다 StackOverflow