views:

166

answers:

2

is it possible to use - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; in viewcontroller.m file? any tutorial pls?

+1  A: 

hitTest:withEvent: method is declared in UIView class so you it can't be used in UIViewController subclasses directly.

But other touch-tracking methods such as touchesBegan:withEvent: etc are declared in UIResponder and so can be implemented in both UIView and UIViewController subclasses

Vladimir
A: 

You can always define a specific delegate for handling the hitTest relevant info. In the hitTest:withEvent: in your UIView class's .m (implementation) file call the delegate's method, passing all your relevant info to the delegate to handle. Declare your ViewController class to implement the delegate like this:

Blockquote> @implementation MyViewController: UIViewController <HitTestDelegate>

This way, the actual implementation of the logic following user's tap will be in the MyViewController class.

DenTheMan