문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top