macOS/iOS API解説

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

目次

hideOtherApplications:

INDEX>AppKit>NSApplication

他の全てのアプリケーションを隠します

Objective-C

- (void)hideOtherApplications:(id)sender

Swift

func hideOtherApplications(_ sender: AnyObject?)

解説

他の全てのアプリケーションを隠します。

返り値

なし

引数

Objective-C

( id )sender

Swift

送信オブジェクト

フレームワーク

ApplicationKit

クラス

NSApplication

使用可能

10.0

編集時のバージョン

10.10

参照

関連記事(外部リンク)


Cocoa: Hide one application - Stack Overflow

例文

Objective-C

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
	[[NSApplication sharedApplication] hideOtherApplications:nil];
}
@end

Swift

//NSApplication hideOtherApplications/unhideAllApplications
    @IBAction func function050(sender: AnyObject) {
        //共有アプリケーションインスタンスを取得
        let anApplication = MyApplication.sharedApplication()
        //
        anApplication.hideOtherApplications(self )
        //タイマー作成
        var timer = NSTimer.scheduledTimerWithTimeInterval(2.0, target: self, selector: Selector("unhideAll:"), userInfo: nil, repeats: false)
    }
    //タイマーが起動した時の実行メソッド
    func unhideAll(timer:NSTimer!) {
        
        let anApplication = NSApplication.sharedApplication()
        //アプリケーション終了
        anApplication.unhideAllApplications(self )
    }