canChooseDirectories
フォルダ(ディレクトリ)を選択することができるかを返します
解説
フォルダ(ディレクトリ)を選択することができるかを返します。
返り値
( BOOL )
YES/NO
引数
フレームワーク
ApplicationKit
クラス
NSOpenPanel
Instance Methods
使用可能
10.0
参照
- setCanChooseDirectories:
例文
#import "Controller.h" @implementation Controller - (IBAction)pushButton:(id)sender { NSOpenPanel *opanel = [NSOpenPanel openPanel]; NSArray *fileTypes = [NSArray arrayWithObjects:@"jpg",@"pdf",@"txt",@"'JPEG'",@"'TEXT'",nil]; int opRet; [opanel setAllowsMultipleSelection:YES]; [opanel setCanChooseDirectories:YES]; [opanel setCanChooseFiles:NO]; if ([opanel canChooseDirectories]){ NSLog(@"canChooseDirectories->YES"); }else{ NSLog(@"canChooseDirectories->NO"); } opRet = [opanel runModalForDirectory:NSHomeDirectory() file:nil types:fileTypes ]; if (opRet == NSOKButton){ NSLog([opanel filename]); [info setStringValue:[opanel filename]]; }else{ NSLog(@"Cansel"); } } -(void)didEndSaveSheet:(NSSavePanel *)savePanel returnCode:(int)returnCode conextInfo:(void *)contextInfo { } @end