macOS/iOS API解説

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

目次

previousLocationInView:

INDEX>UIKit>UITouch

前回のタッチの位置を取得します。
-(CGPoint)previousLocationInView:(UIView *)view

解説

返り値

( CGPoint )

引数

( UIView * )view

クラス

UITouch

Instance Methods

使用可能

iPhone2.0

参照

例文

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