macOS/iOS API解説

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

目次

set

レシーバーの変換マトリックスに現在の変換マトリックスをセットします

解説

レシーバーの変換マトリックスに現在の変換マトリックスをセットします。
(NSAffineTransformクラス、10.3までのAppKitから10.4からFoundationに変更)

返り値

( void )

なし

引数

クラス

NSAffineTransform

Instance Methods

使用可能

10.0

参照

例文

#import "MyView.h"

@implementation MyView

//NSViewのサブクラス MyViewのDrawRectに上書き
-(void)drawRect:(NSRect)rect
{
	//初期設定
	int i;
	NSBezierPath *thePath1 = [NSBezierPath bezierPath];
	NSAffineTransform *affin = [NSAffineTransform transform];
	
	//描画開始点に移動
	[thePath1 moveToPoint:NSMakePoint(100,100)];
	//●を記述
	[thePath1 appendBezierPathWithOvalInRect:NSMakeRect(100,100,2,2)];
	//色をブルーに
	[[NSColor blueColor] set];
	//塗る
	[thePath1 fill];
	[affin rotateByDegrees:1.0];
	for (i=1;i<360;i++){
		//変換を記述
		
		[affin set];
		
		//変換
		[thePath1 transformUsingAffineTransform: affin];
		//塗る
		[thePath1 fill];
	}
}

@end