macOS/iOS API解説

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

目次

locationInView:

INDEX>UIKit>UITouch

タッチの、指定したビューでの座標を取得します。
-(CGPoint)locationInView:(UIView *)view

解説

タッチの、指定したビューでの座標を取得します。

返り値

( CGPoint )

引数

( UIView * )view

クラス

UITouch

Instance Methods

使用可能

iPhone2.0

参照

例文

- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
	UITouch*			touch = [touches anyObject];
	CGPoint aPoint = [touch locationInView:self];
	NSLog(@"x = %f , y = %f",aPoint.x,aPoint.y);

	[self touchesMoved:touches withEvent:event];
}