beginSheetForDirectory:file:modalForWindow:modalDelegate:didEndSelector:contextInfo:
セーブパネルをシートで表示します
-(void)beginSheetForDirectory:(NSString *)path: file:(NSString *)name: modalForWindow:(NSWindow *)docWindow: modalDelegate:(id)delegate: didEndSelector:(SEL)didEndSelector: contextInfo:(void *)contextInfo:
解説
セーブパネルをシートで表示します。
docWindowをnilにするとシートではなくモーダルウインドウになります。
返り値
( void )
なし
引数
( NSString * )path
パス
( NSString * )name
ファイル名
( NSWindow * )docWindow
ドキュメントウインドウ
( id )delegate
デリゲート
( SEL )didEndSelector
パネル終了時のセレクタ
( void * )contextInfo
追加情報
フレームワーク
ApplicationKit
クラス
NSSavePanel
Instance Methods
使用可能
10.0
参照
例文
#import "Controller.h" @implementation Controller - (IBAction)pushButton:(id)sender { NSSavePanel *spanel = [NSSavePanel savePanel]; [spanel setRequiredFileType:@"rtfd"]; [spanel beginSheetForDirectory:NSHomeDirectory() file:nil modalForWindow:myWindow modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:conextInfo:) contextInfo:NULL]; [spanel autorelease]; } -(void)didEndSaveSheet:(NSSavePanel *)savePanel returnCode:(int)returnCode conextInfo:(void *)contextInfo { if (returnCode == NSOKButton){ NSLog([[savePanel URL] absoluteString]); }else{ NSLog(@"Cansel"); } } @end