active
アプリケーションがアクティブかどうか
@property(getter=isActive, readonly) BOOL active
var active: Bool { get }
解説
アプリケーションがアクティブかどうかを返します。
フレームワーク
ApplicationKit
クラス
NSApplication
使用可能
10.10
更新時のバージョン
OS X 10.10
参照
関連記事(外部サイト)
例文
//NSApplication active @IBAction func function047(sender: AnyObject) { //共有アプリケーションインスタンスを取得 let anApplication = MyApplication.sharedApplication() // if (anApplication.active) { NSLog("NSApplication active") anApplication.hide(self) //タイマー作成 var timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("hideCheck:"), userInfo: nil, repeats: false) }else{ NSLog("NSApplication not active") } } //タイマーが起動した時の実行メソッド func hideCheck(timer:NSTimer!) { let anApplication = MyApplication.sharedApplication() // if (anApplication.active) { NSLog("NSApplication active") }else{ NSLog("NSApplication not active") } }