Re: Problems with gesture recognizer & child view controller
Re: Problems with gesture recognizer & child view controller
- Subject: Re: Problems with gesture recognizer & child view controller
- From: Damian Carrillo <email@hidden>
- Date: Fri, 15 Mar 2013 10:10:36 -0500
Hi Timothy,
What I would try to do is, break in the debugger on viewDidLoad of your primary view controller, and issue the following:
po [[self view] recursiveDescription]
It will print out the view hierarchy so that you can begin to deduce what the actual problem is. Some mistakes that I seem to continually make when using gesture recognizers are:
* I forget to ensure that UIImageViews have their userInteraction property set to YES
* I forget to add a target and action (particularly when I'm refactoring using nibs or storyboards)
* With multiple gesture recognizers in a view hierarchy, I sometimes accidentally set cancelsTouchesInView on the top one
I hope this helps,
Damian
On Mar 14, 2013, at 6:55 PM, Timothy Reaves wrote:
> In my iOS app, I had a single primary view controller. This controlled three views, one of which had a gesture recognizer. This worked well. However, as the code grew, refactored this into three view controllers, as the primary view controller was doing too much, and it was beginning to get confusing as to where what was happening.
>
> The new design as my primary view controller, and two child view controllers. Each of the two child view controllers has a custom view: one on the top part of the screen, and one of the bottom. The two child view controllers views do not overlap. The gesture recognizer is for on of the child view controllers.
>
> I have this all displaying correctly, and it's a much nicer design. It's now easy to figure out where what code is, and where functionality should go. The problem is, the gesture recognizer no longer receives touch events. I've search around for this problem, and see where other people have it when they stack views on top of each other. So I think that is what is happening here. My primary view controller's view is not visible - it's not used, except for some overall gesture recognizers, and some pop-evers. So the view in the child view controller should not be behind anything.
>
> I'm not sure what to try now to troubleshoot this. Any pointers will be greatly appreciated.
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden