0
私はデュアルアプリケーションを持っており、touchesBeganのコードブロックをiPhoneコードからiPadにコピーしました。私は何も変更を加えていないし、メソッドは、最初のタッチのために私にxとyのためのゼロを常に与える。iPhone touchesBegianがiPadで動作しない、xとyは常にゼロ
コードブロック:私は常に正しい方法はUITouch
取得することを見てきました
-(void) touchesBegan: (NSSet *) touches withEvent: (UIEvent *) event {
int iCardId;
NSSet *allTouches = [event allTouches];
// we are dealing with one finger get first touch
// get first touch
UITouch *touch=[[allTouches allObjects] objectAtIndex:0];
// get the x and y
CGPoint pt = [touch locationInView: self.view];
float x=pt.x; // this is always a zero
float y=pt.y; // this is always a zero
.........
.........
.........
}
こんにちは、iPad用でしたか?コードはiPhone上で動作し、それが動作しないiPadにコピーしました。 –
iPadシミュレータ。 – mbm29414