beginModalSessionForWindow:
ウインドウのモーダルセッションを開始します
-(NSModalSession)beginModalSessionForWindow:(NSWindow *)aWindow:
解説
ウインドウのモーダルセッションを開始します。
モーダルウインドウはcenterメソッドで中心に表示されます。
モーダル監視は自分で行わなければなりません。
NS_DURINGブロックで例外をキャッチするようにします。
返り値
( NSModalSession )
モーダルセッション
引数
( NSWindow * )aWindow
ウインドウ
フレームワーク
ApplicationKit
クラス
NSApplication
Instance Methods
使用可能
10.0
参照
例文
#import "Controller.h" @implementation Controller NSModalSession mSession; - (IBAction)startModal:(id)sender { int modalCode; [NSApp stopModal]; mSession = [NSApp beginModalSessionForWindow:panelWin]; //モーダルの状態を監視 do { //例外のハンドリング NS_DURING modalCode = [NSApp runModalSession: mSession]; NS_HANDLER NSLog(@"%s\n", [[localException name] cStringUsingEncoding:NSASCIIStringEncoding]); NS_ENDHANDLER NSLog(@"--- noumal "); } while (modalCode == NSRunContinuesResponse); } - (IBAction)endModal:(id)sender { [NSApp stopModal]; [NSApp endModalSession:mSession]; [panelWin orderOut: self]; } @end