0
NSFontPanel이 닫혔다는 것을 처리해야합니다. 어떤 방법이있을 때 호출 되는가? 회신을위한 Thx.NSFontPanel - 종료 처리 방법
NSFontPanel이 닫혔다는 것을 처리해야합니다. 어떤 방법이있을 때 호출 되는가? 회신을위한 Thx.NSFontPanel - 종료 처리 방법
NSFontPanel은 NSWindow의 하위 클래스 인 NSPanel의 하위 클래스입니다. NSWindow에는 윈도우 상태의 변화를 알려주는 많은 델리게이트 메소드가 있습니다.
윈도우 컨트롤러 또는 응용 프로그램 대리인에서 NSWindowDelegate에 대한 적합성을 선언 한 다음 글꼴 패널을 가져 와서 해당 대리자를 컨트롤러 개체로 설정하십시오. 마지막으로 -windowWillClose:
을 컨트롤러 객체에 구현하고 필요한 모든 조치를 취하십시오. 예를 들어
:
/* AppDelegate.h */
@interface AppDelegate : NSObject <NSWindowDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
/* AppDelegate.m */
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSFontPanel *fp = [[NSFontManager sharedFontManager] fontPanel:YES];
fp.delegate = self;
}
- (void)windowWillClose:(NSNotification *)notification
{
if(notification.object == [[NSFontManager sharedFontManager] fontPanel:NO])
{
/* Handle font panel close here */
NSLog(@"Font panel closing");
}
}
@end