setDelegate:
デリゲートをセットします
-(void)setDelegate:(id)anObject:
解説
デリゲートをセットします。
返り値
( void )
なし
引数
( id )anObject
オブジェクト
フレームワーク
ApplicationKit
クラス
NSSavePanel
Instance Methods
使用可能
10.0
参照
例文
#import "Controller.h" @implementation Controller - (IBAction)pushButton:(id)sender { NSSavePanel *spanel = [NSSavePanel savePanel]; //デリゲート設定 [spanel setDelegate:self]; //ファイルタイプ設定 [spanel setRequiredFileType:@"rtfd"]; //セーブパネル開く [spanel beginSheetForDirectory:NSHomeDirectory() file:nil modalForWindow:myWindow modalDelegate:self didEndSelector:@selector(didEndSaveSheet:returnCode:conextInfo:) contextInfo:NULL]; } //セーブパネルのデリゲート -(NSComparisonResult)panel:(id)sender compareFilename:(NSString *)fileName1 with:(NSString *)fileName2 caseSensitive:(BOOL)flag { NSLog([NSString stringWithFormat:@"%@,%@",fileName1,fileName2]); return [fileName1 compare:fileName2]; } //パネル終了 -(void)didEndSaveSheet:(NSSavePanel *)savePanel returnCode:(int)returnCode conextInfo:(void *)contextInfo { if (returnCode == NSOKButton){ //NSLog([[savePanel URL] absoluteString]); }else{ NSLog(@"Cansel"); } } @end