finishLaunching
起動した後に呼び出されます
解説
起動した後に呼び出されます。
このメソッドを開始するときにデフォルトの通知センターにNSApplicationWillFinishLaunchingNotificationをポストします。
このメソッドを終了するときにデフォルトの通知センターにNSApplicationDidFinishLaunchingNotificationをポストします
このメソッドをオーバーライドする場合はスーパークラスを呼び出さないといけません。
オーバーライドした時には「アプリケーション設定」の「Cocoa固有の設定」をNSApplicationから、サブクラス(たとえばMyApplication)に変更しないといけません
Info.plistのNSPrincipalClassキーの値を(たとえば)MyApplicationにする。
返り値
( void )
なし
引数
フレームワーク
ApplicationKit
クラス
NSApplication
Instance Methods
使用可能
10.0
参照
- applicationWillFinishLaunching:
- applicationDidFinishLaunching:
例文
#import "MyApplication.h" @implementation MyApplication -(void)finishLaunching { //デフォルトの通知センターをnCenterに NSNotificationCenter *nCenter =[NSNotificationCenter defaultCenter]; //nCenterにオブザーバーを加える [nCenter addObserver:self selector:@selector(applicationWillLaunchNotify:) //呼び出されるメソッド name:@"NSApplicationWillFinishLaunchingNotification" //ウインドウがリサイズされたら object:nil]; //nCenterにオブザーバーを加える [nCenter addObserver:self selector:@selector(applicationDidLaunchNotify:) //呼び出されるメソッド name:@"NSApplicationDidFinishLaunchingNotification" //ウインドウがリサイズされたら object:nil]; //隠す NSLog(@"finishLaunching"); [super finishLaunching]; } //NSApplicationWillFinishLaunchingNotificationが通知されたときのメソッド - (void)applicationWillLaunchNotify:(NSNotification *)notification { NSLog(@"recive NSApplicationWillFinishLaunchingNotification"); } //NSApplicationDidFinishLaunchingNotificationが通知されたときのメソッド - (void)applicationDidLaunchNotify:(NSNotification *)notification { NSLog(@"recive NSApplicationDidFinishLaunchingNotification"); } @end