macOS/iOS API解説

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

目次

unhideAllApplications:

INDEX>AppKit>NSApplication

レシーバーを含む全てのアプリケーションを表示します

Objective-C

- (void)unhideAllApplications:(id)sender

Swift

func unhideAllApplications(_ sender: AnyObject?)

解説

レシーバーを含む全てのアプリケーションを表示します。

返り値

なし

引数

Objective-C

( id )sender

Swift

送信オブジェクト

フレームワーク

ApplicationKit

クラス

NSApplication

使用可能

10.0

編集時のバージョン

10.10

参照

例文

Objective-C

#import "Controller.h"

@implementation Controller
NSTimer *timer=nil;

- (IBAction)pushButton:(id)sender
{
	[[NSApplication sharedApplication] hide:nil];

	NSDate *theDate = [NSDate dateWithTimeIntervalSinceNow:10]; //10秒後にタイマー起動  
	//userInfoに使う辞書を作成
	NSDictionary *userInfoDictionary =[NSDictionary dictionaryWithObjectsAndKeys:
						self,@"key",nil];
	//タイマー作成
	timer = [NSTimer scheduledTimerWithTimeInterval:1.0
							target:		self
							selector:	@selector(timerControl:)
							userInfo:	userInfoDictionary
								repeats:NO];
	//起動時間セット
	[timer setFireDate:theDate];
	[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSModalPanelRunLoopMode];

}

-(void) timerControl:(NSTimer *)aTimer
{
	[NSApp unhideAllApplications:[[aTimer userInfo] objectForKey:@"key"]];
}


@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 )
    }