macOS/iOS API解説

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

目次

valueWithPoint:

指定したNSPoint構造を含むNSValueオブジェクトを作って、返します

Macのみ
iOSはvalueWithCGPoint:を使用

+(NSValue *)valueWithPoint:(NSPoint)aPoint

解説

指定したNSPoint構造を含むNSValueオブジェクトを作って、返します。
参考
NSPoint point = NSPointFromCGPoint(myCGPoint);
CGPoint point = NSPointToCGPoint(myNSPoint);

返り値

( NSValue * )

値オブジェクト

引数

( NSPoint )aPoint

ポイント

クラス

NSValue

Class Methods

使用可能

10.0

参照

- pointValue

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
	//NSPointを渡す場合
	NSValue *value = [NSValue valueWithPoint:NSMakePoint(1.23456,7.89012)];

	NSPoint bufferPoint;
	[value getValue:&bufferPoint];
	NSLog(@"---%f,%f",bufferPoint.x,bufferPoint.y);
	NSLog(@"---%f,%f",[value pointValue].x,[value pointValue].y);

}

@end