iPhoneのタッチの座標を参照する方法
以下の何れかのメソッドを実装する。
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
で、そのメソッドの中で以下のように取り出す。
CGPoint point = [[touches anyObject] locationInView:self.view];
locationInViewのパラメータは所謂viewを指定する。
メインのview以外を指定すると、そのview内の座標になるのか?
誰か試して教えて!