NSAlertStyle
アラートパネルのスタイル
enum { NSWarningAlertStyle = 0, NSInformationalAlertStyle = 1, NSCriticalAlertStyle = 2 }; typedef NSUInteger NSAlertStyle;
enum NSAlertStyle : UInt { case WarningAlertStyle case InformationalAlertStyle case CriticalAlertStyle }
解説
アラートパネルのスタイル
- WarningAlertStyle
- InformationalAlertStyle
- CriticalAlertStyle
フレームワーク
ApplicationKit
クラス
NSAlert
使用可能
10.3-
編集時のバージョン
OS X 10.10
関連記事(外部サイト)
例文
//NSAlert NSAlertStyle @IBAction func function017(sender: AnyObject) { NSLog("function017 called") //なにかモーダルがあっても終わり NSApp.abortModal() //テキストの作成 let messageText:String = "Message text" as String let informativeText:String = "Information text" as String //NSAlertの作成 let alert:NSAlert = NSAlert() alert.alertStyle = .CriticalAlertStyle //1つめのボタン alert.addButtonWithTitle(NSLocalizedString("Stop", comment:"停止")) //2つめのボタン alert.addButtonWithTitle(NSLocalizedString("Continue", comment:"")) //シートを出す alert.beginSheetModalForWindow(window) { responseCode in if NSAlertSecondButtonReturn == responseCode { NSLog("SecondButton") } } }