0

I have an application where I am creating and adding PrimaryViewController to a UIScrollView, when the user taps on a button on PrimaryViewController's view, I create and add a SecondViewController to the UIScrollView. The SecondViewController creates and adds a new UIScrollView to it's view.

My problem is this: I need to get a tap event on the SecondViewController's UIScrollView. But when I tap on the SecondViewController's UIScrollView it throws an error (unrecognized selector). I believe it has to do with the view hierarchy and the fact that I am creating a new SecondViewController each time the button on PrimaryViewController's view is tapped (which I need to do). Does anyone know how to solve this view-hierarchy issue? If you need more of an explanation let me know.

tentmaking
  • 2,076
  • 4
  • 30
  • 53
  • "Throws an error" is not much explanatory – Bruno Koga Jun 01 '13 at 17:18
  • why you are adding view on scrollview? why not adding it PrimaryViewController's view? – Divyu Jun 01 '13 at 17:18
  • Sorry that wasn't clear. I am adding the primary view controllers view to the UIScroll view. Also, the error that is being thrown doesn't say anything other than it is a unrecognized selector. – tentmaking Jun 01 '13 at 17:50
  • It should say something like `-[Class selector:]: unrecognized selector sent to instance`. The first half there is the important part. – maroux Jun 01 '13 at 18:20

1 Answers1

0

A friend helped me solve my issue. I was creating a new SecondViewController each time the PrimaryViewController's button was tapped. I changed it so I just update the data in the SecondViewController instead of creating an entirely new view controller. I still don't quite understand the problem, but will update this post if I figure out why.

tentmaking
  • 2,076
  • 4
  • 30
  • 53