macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:

モーダルウインドウを表示します
-(void)beginSheet:(NSWindow *)sheet:
             modalForWindow:(NSWindow *)docWindow:
             modalDelegate:(id)modalDelegate:
             didEndSelector:(SEL)didEndSelector:
             contextInfo:(void *)contextInfo:

解説

モーダルウインドウを表示します。
終了時に呼び出されるセレクタ

  • (void)sheetDidEnd:(NSWindow*)sheet returnCode:(int)returnCode contextInfo:(void*)contextInfo

{}
の形式でなければいけません。

返り値

( void )

なし

引数

( NSWindow * )sheet

シートウインドウ

( NSWindow * )docWindow

シートをつけるウインドウ

( id )modalDelegate

デリゲート

( SEL )didEndSelector

終了時のセレクタ

( void * )contextInfo

追加情報

フレームワーク

ApplicationKit

クラス

NSApplication

Instance Methods

使用可能

10.0

参照

-endSheet:
-endSheet:returnCode:

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{

[NSApp stopModal];

[NSApp beginSheet:panelWin
                modalForWindow:myWindow
                modalDelegate:self
                didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
                contextInfo:nil
                ];

}
- (void)sheetDidEnd:(NSWindow*)sheet 
                returnCode:(int)returnCode 
                contextInfo:(void*)contextInfo
{
    [sheet orderOut:self];
    NSLog(@"returnCode %d",returnCode);
}
@end