Reputation: 11
I want to get the object at the location of where the touch is lifted (off the screen).
This will be used to implement a drag-and-drop and I have these methods for overriding:
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event;
Using [[touches anyObject] view]
in touchesEnded:withEvent: gives me the UIView object of where I first touched but not where I released my touch.
Using [[touches anyObject] locationInView:self.view]
does give me the location of where the touch was released but I would have to map the coordinates to UIView.
Upvotes: 0
Views: 616
Reputation: 11
The answer to this question was answered in a different question worded differently.
Answered by @Ronak Chaniyara: https://stackoverflow.com/a/16329436/3920809
Upvotes: 0