UIViewController does not receive touchsBegan message

I have a pretty simple UIViewController. It was initialized with the view I created in Interaface Builder, which contains only UIImageView. When the user touches the screen, I want the touchsBegan UIViewController message to be called. So, I override it and added some entries, but nothing happened.

I didn’t do anything β€œespecially” at all, since the UIViewController inherits from the UIResponder, I expect this to work right out of the box. From what I understand, UIImageViews turned off user interaction by default, so I turned it on both through InterfaceBuilder and in my viewDidLoad UIViewcontroller method (I bound UIImageView to IBOutlet). I also guarantee that userInteraction is included in the parent view in Interface Builder.

Anything else that I forget here?

+3
source share
3 answers

Ok, I'm a mannequin. It is working fine. The problem was that I did not understand that I was sending the release message to the UIViewController without saving it in another place. This caused a problem.

+3
source

, , , , ?

, touchsBegan IBAction Interface Builder?

IBAction IBAction. , .

IBOutlet, IBAction, .

0

, . , . touchBegan canBecomeFirstResponder, . IB, .

0
source

Source: https://habr.com/ru/post/1710968/


All Articles