2015-02-06 4 views
2

코코아 프로그램에 작은 도움 버튼이 있습니다. 나는 그것을 눌렀을 때 많은 텍스트가있는 작은 nswindow 패널 팝업을 만드는 방법을 궁금해하고있었습니다. 어떻게해야합니까? 버튼의 이름은 help이고, 창은 helpwin버튼을 눌렀을 때 NSWindow 팝업을 만드는 방법

+0

어떤 종류의 창을 튀기시겠습니까? 텍스트가 있고 "취소", "확인"등과 같은 버튼이있는 것은? 아니면 모든 기능을 갖춘 창을 찾고 계십니까? –

+0

나는 그것을 편집했다. 패널을 갖고 싶습니다. (그것은 UI 제작자에 있습니다) –

답변

1

이라고 할 수 있습니다. 필자가해야 할 일은 패널의 @property를 만드는 것뿐입니다. 그런 다음 내 단추 IBAction에서 작성했습니다.

- (IBAction)help:(id)sender { 
    if (![self.helpWin isVisible]) { 
     [self.helpWin makeKeyAndOrderFront:sender]; 
    } 
} 

그리고 작동합니다!

1

패널의 정교함에 따라 NSRunAlertPanel을 간단하게 팝업 할 수 있습니다.

-(IB Action)helpPanel:(id)sender 
{ 
    NSInteger choice = NSRunAlertPanel(@"Help", @"The previous string is the titel or main message of your alert panel. This is theft can be longer. You then have three buttons to fill in, the default button and two alternate buttons. With the alternate buttons on 'nil', you get only one button.", @"ok", nil, nil); 
} 
관련 문제