RockStar
RockStar

Reputation: 1314

touchesBegan not calling on container view controller

I have a view controller which contains container view controller.

I override touchesBegan function inside both

  1. View Controller

  2. Container View Controller

View controllers touch begin only called when tap outside the container view.

Container view controller touch begin never get called even clicked on container view.

My requirement is that whenever anywhere I tap on main view controller touch begin should be called.

How can I proceed for it?

enter image description hereenter image description here

Upvotes: 0

Views: 1380

Answers (1)

Yaser
Yaser

Reputation: 408

It might be that something else is consuming your touches. If I understand your setup correctly, you have the SignupViewController inside ViewController. The SignupViewController has a scroll-view in it - I would assume that it is consuming the touches.

Managing touch event functions together with a scrollview is kind of tricky (but can be done). In my experience, UIGestureRecognizer (tap, pan etc - there are some subclasses) are much easier to work with.

Edit: Looked at some old code and simultaneous gesturerecognizers (i.e. scroll and your own) is possible but you need to explicitly allow it. See this answer

Upvotes: 1

Related Questions