macOS/iOS API解説

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

目次

NSRequestUserAttentionType

INDEX>AppKit>NSApplication

要求するユーザーのアテンションタイプ

Objective-C

enum {
   NSCriticalRequest = 0,
   NSInformationalRequest = 10
}
typedef NSUInteger NSRequestUserAttentionType;

Swift

enum NSRequestUserAttentionType : UInt {
    case CriticalRequest
    case InformationalRequest
}

解説

要求するユーザーのアテンションタイプ

フレームワーク

ApplicationKit

クラス

NSApplication

使用可能

10.1

更新時のバージョン

OS X 10.10

関連記事(外部サイト)

例文

//NSApplication requestUserAttention
    @IBAction func function060(sender: AnyObject) {
        //共有アプリケーションインスタンスを取得
        let anApplication = MyApplication.sharedApplication()
        anApplication.requestUserAttention(NSRequestUserAttentionType.CriticalRequest)
        //デアクティベートして
        anApplication.hide(self) //deactivate()
        //3秒後にユーザーアテンションを
        var startTimer = NSTimer.scheduledTimerWithTimeInterval(3.0, target: self, selector: Selector("requestAttention:"), userInfo: nil, repeats: false)
        //10秒後にユーザーアテンションを
        var stopTimer = NSTimer.scheduledTimerWithTimeInterval(10.0, target: self, selector: Selector("cancelAttention:"), userInfo: nil, repeats: false)
        
    }
    //タイマーが起動した時の実行メソッド ドックで跳ねる
    func requestAttention(timer:NSTimer!) {
        //共有アプリケーションインスタンスを取得
        let anApplication = MyApplication.sharedApplication()
        //ユーザーアテンションを開始
        NSLog("start attention")
        anApplication.requestUserAttention(NSRequestUserAttentionType.CriticalRequest)
    }
    //タイマーが起動した時の実行メソッド ドックではねているのをやめる
    func cancelAttention(timer:NSTimer!) {
        //共有アプリケーションインスタンスを取得
        let anApplication = MyApplication.sharedApplication()
        //ユーザーアテンションを停止
        NSLog("stop attention")
        anApplication.cancelUserAttentionRequest(0)
    }