delegate
デリゲートオブジェクト
@property(assign) id<NSAlertDelegate> delegate
unowned(unsafe) var delegate: NSAlertDelegate?
解説
デリゲートオブジェクト
リモートオブジェクトの場合はnil
設定値
id<NSAlertDelegate>
NSAlertDelegate?
オブジェクト()
フレームワーク
ApplicationKit
クラス
NSAlert
使用可能
10.3
参照
-setDelegate:
-alertShowHelp:
例文
NSLog([[alert delegate] description]);
//NSAlert delegate @IBAction func function008(sender: AnyObject) { //なにかモーダルがあっても終わり NSApp.abortModal() //テキストの作成 let messageText:String = "Message text" as String let informativeText:String = "Information text" as String //NSAlertの作成 let alert:NSAlert = NSAlert() alert.alertStyle = .WarningAlertStyle alert.messageText = messageText alert.informativeText = informativeText alert.delegate = self var delegateObj = alert.delegate//Swift 1.2 //var delegateObj = alert.delegate? if (delegateObj != nil) { if (delegateObj!.conformsToProtocol(NSAlertDelegate)) { NSLog("YES") }else{ NSLog("NO") } }else{ NSLog("nil") } let response:Int = alert.runModal() }