2013-05-21
画面のタッチ位置の取得
画面をポンとタッチしたときの座標値を表示する。
(参考: [iOS] タッチした座標を取得 | HAPPY*TRAP)
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { CGPoint p = [[touches anyObject] locationInView:self.view]; float tap_x = p.x; float tap_y = p.y; NSLog(@"(%f, %f)", tap_x, tap_y); }
- 処理手順の整理
- タッチ位置を確認
- それはどこに対応するか
- そこにピースがあるか
- そのピースは移動できるか
- 移動できれば移動する





