macOS/iOS API解説

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

目次

application:openFiles:

複数ファイルをドロップしてアプリケーションを起動したときに呼び出されます
-(void)application:(NSApplication *)sender:
                  openFiles:(NSArray *) filenames :

apple(mac)

解説

複数ファイルをドロップしてアプリケーションを起動したときに呼び出されます。

返り値

( void )

なし

引数

( NSApplication * )sender
( NSArray * ) filenames 

ドロップされたファイルの配列

フレームワーク

ApplicationKit

*

NSApplication Delegate

Protocol

使用可能

10.3

参照

例文

#import "Controller.h"

@implementation Controller
//File's ownerのデリゲートにこのクラスが接続されている
//ターゲット アプリケーション設定 書類のタイプ 役割Editer 拡張子"*** *" OSタイプ"*** *"を設定してある
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename;{
	if (filename != nil){
		//[info setStringValue:filename];
		NSLog(@"single file");
		return YES;
	}else{
		return NO;
	}
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames;
{
    [info setStringValue:[filenames description]];
}
#endif
@end