Reputation: 1660
I am writing an iPad app for work, and this app uses a custom UIView (so I can't change its code). I've been having issues intercepting touch events and passing them on to this app, so figure that I could send a signal from the view to my view controller when a touch happens.
The problem though, is that with a UIControl, I can send a signal, but I don't think I can do the same from a UIView. Is there a way to do this?
Upvotes: 0
Views: 275
Reputation: 4767
Using UITouch
looks a close one to me.
UITouch *touch = [[event allTouches] anyObject];
CGPoint touchPoint = [touch locationInView:self.view];
Upvotes: 0
Reputation: 603
You can use a UITapGestureRecognizer and that will call a method which you can then call a delegate method in your UIViewController or send a notification using NSNotificationCentre which your ViewController listens for. Here is the documentation for working with a UITapGestureRecognizer https://developer.apple.com/library/ios/documentation/uikit/reference/UITapGestureRecognizer_Class/Reference/Reference.html
But if you need any help understanding the examples let me know.
Upvotes: 1