0
タッチを離した場所(画面外)でオブジェクトを取得したい。 UITouchの場所でUIViewオブジェクトを取得する方法 - (void)touchesEnded:withEvent :?
この
は、ドラッグ&ドロップを実装するために使用され、私はこれらのオーバーライドする方法があります:touchesEndedで[[touches anyObject] view]
を使用して
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
を:withEvent:私が最初に触れたところののUIViewオブジェクトを与えるではなく、私はどこに触れたのですか?
[[touches anyObject] locationInView:self.view]
を使用すると、タッチが解放された場所がわかりますが、座標をUIViewにマップする必要があります。
は、これが役立つことができる:http://stackoverflow.com/questions/16328875/how-to-find-out-what-view-a-touch-event -ended-at](http://stackoverflow.com/questions/16328875/how-to-find-out-what-view-a-touch-event-ended-at) –
@Ronak Chaniyara AH。ありがとうございました。私はどこにでも見つけることができませんでした。私はちょうど間違った言葉を捜していたと思う。 – David
あなたはそれを修正しました!@David –