macOS/iOS API解説

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

目次

replyToOpenOrPrint:

openFiles,printFilesの結果の処理をします
-(void)replyToOpenOrPrint:(NSApplicationDelegateReply )reply:

解説

openFiles,printFilesの結果の処理をします。
application:openFiles:
application:printFiles:デリゲートメソッドから呼び出します。
【NSApplicationDelegateReply】
●NSApplicationDelegateReplySuccess
●NSApplicationDelegateReplyCancel
●NSApplicationDelegateReplyFailure

返り値

( void )

なし

引数

( NSApplicationDelegateReply  )reply

フレームワーク

ApplicationKit

クラス

NSApplication

Instance Methods

使用可能

10.3

参照

例文

#import "AppDelegate.h"

@implementation AppDelegate
//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;
{

    [NSApp replyToOpenOrPrint:(filenames != nil) ? NSApplicationDelegateReplySuccess : NSApplicationDelegateReplyFailure];
	
    [info setStringValue:[filenames description]];

}
#endif
@end