UIViewController does not respond to touches

Hi everyone, I'm completely stumped with this iPhone issue.

This is my first time you create a view programmatically, without a tip. I can get a view that displays everything just fine, but the darn ViewController does not respond to how it is used to the programs in which I used the tip. I have to add that in the past I started with a view-based application template, and this time I used a window-based template.

My thinking is that the View-Based template does something magical so that the iPhone knows where to send touch events, but I can’t understand what it will be even after a few hours of uncertainty on Google. Or I could look in a completely wrong place, and my problems are related to something else. Any thoughts?

0
source share
3 answers

There is nothing magical about a presentation-based template. The most likely causes for refusing to touch are:

  • You came across touchesBegan:withEvent: userInteractionEnabled , exclusiveTouch or something else, thinking you need to bother with them (usually you don’t do this, by default, they are usually correct)

  • You created a second UIWindow

  • You put something on top of the view (even if it's transparent)

Simplify your code by simply creating a view programmatically that responds to touch and nothing more. It should be just a few lines of code. If you can't get this to work, post the code and we will see what happens.

+1
source

The problem is resolved. tap s Finished! = tap d Finished.

This will teach me how to program without glasses.

0
source

Another possible failure scenario in response to touches is when your VC frame is not predefined and its borders actually exceed the window size.
This happens very often when you simply forget to define the frame property for VC.

Once you determine it correctly, user interaction will return to normal.

Good luck

0
source

All Articles