views:

29

answers:

1

I'm working on my first iPhone application, and I'm getting some very strange behavior when I try to implement touch events.

I set up touchesBegan:withEvent: and its sister methods under a subclass of UIViewController, but they aren't registering. What's even weirder is that when I try using touches on the simulator while running the console, the console logs my touches, even though I have no NSLog statements in my program at all! At one point, I set up NSLog statements under touchesBegan:withEvent: etc., but I deleted them soon after. I have no idea where these logs are coming from.

Is this some issue with the responder chain? Why is the console behaving so weirdly? Any ideas?

A: 

Not weird at all. View controllers are just controllers - not views. You need to implement them in your UIView subclasses.

As for the strange console output - maybe a clean rebuilt will help, or we need some code to look at.

Eiko
According to Apple's documentation, view controllers are also responders and can handle touch events. I've set up a new test projects with a view controller and implemented the four touch methods and it registered fine...And I did a clean rebuild which fixed the strange console output, so thanks!
Jigglyman