macOS/iOS API解説

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

目次

setContentView:

内容ビューをセットします
-(void)setContentView:(NSView *)view:

解説

内容ビューをセットします
表示する場合は-displayを呼び出します。

返り値

( void )

引数

( NSView * )view

フレームワーク

ApplicationKit

クラス

NSDockTile

Instance Methods

使用可能

10.5

参照

例文

#import "Controller.h"


@implementation Controller
NSTimer *timer=nil;



-(void) timerControl:(NSTimer *)aTimer
{
	[[NSApp dockTile] display];
	NSLog(@"...%@",[[aTimer userInfo] objectForKey:@"key2"]);
	
}

- (IBAction)pushButton:(id)sender
{
	#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
	
	NSDockTile * tile = [NSApp dockTile];
	
	//スクリーン座標でのサイズ
	NSLog(@"owner %@",[[tile owner] className]);
	[tile setContentView:dockView];
	[tile display];
	
	#endif
	NSDate *theDate = [NSDate dateWithTimeIntervalSinceNow:0]; //10秒後にタイマー起動  
	//userInfoに使う辞書を作成
	NSDictionary *userInfoDictionary =[NSDictionary dictionaryWithObjectsAndKeys:
						@"value1",@"key1",
						@"value2",@"key2",
						@"value3",@"key3",nil];
	//タイマー作成
	timer = [NSTimer scheduledTimerWithTimeInterval:1.0
							target:		self
							selector:	@selector(timerControl:)
							userInfo:	userInfoDictionary
								repeats:YES];
	//起動時間セット
	[timer setFireDate:theDate];
	[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
	
}

@end