NSApplicationDelegateReply
デリゲートのリプライ
enum NSApplicationDelegateReply { NSApplicationDelegateReplySuccess = 0, NSApplicationDelegateReplyCancel = 1, NSApplicationDelegateReplyFailure = 2 } typedef NSUInteger NSApplicationDelegateReply;
enum NSApplicationDelegateReply : UInt { case Success case Cancel case Failure }
解説
デリゲートのリプライ
フレームワーク
ApplicationKit
クラス
NSApplication
使用可能
10.3
更新時のバージョン
OS X 10.10
関連記事(外部サイト)
例文
//アプリケーションがファイルドロップでOpenされた //ターゲット アプリケーション設定 書類のタイプ 役割Editer 拡張子"*** *" OSタイプ"*** *"を設定してある func application(sender: NSApplication, openFiles filenames: [AnyObject]) { remoteStateTextField.stringValue = "File drop open" var firstMissingFile :NSString? = nil ; var files : NSMutableArray = NSMutableArray() var i : Int var count :Int = filenames.count for (i = 0 ; i < count ; ++i){ var name : NSString = (filenames as NSArray).objectAtIndex(i) as NSString if (NSFileManager.defaultManager().fileExistsAtPath(name)){ files.addObject(name) }else if ( firstMissingFile != nil ){ firstMissingFile = name } } if ( firstMissingFile != nil ){ var alert : NSAlert = NSAlert() alert.addButtonWithTitle("OK") var text :NSString if (files.count >= count-1){ alert.messageText = "aaaaa" text = "Could not open file with" }else{ alert.messageText = "Multiple files not found" text = "Could not open file with" } alert.informativeText = text alert.alertStyle = NSAlertStyle.CriticalAlertStyle alert.runModal() NSApp.replyToOpenOrPrint(NSApplicationDelegateReply.Failure) } }