Skip to content
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.

whenTapped gets leaked #47

Closed
RVLVR opened this issue Dec 13, 2011 · 2 comments
Closed

whenTapped gets leaked #47

RVLVR opened this issue Dec 13, 2011 · 2 comments
Milestone

Comments

@RVLVR
Copy link

RVLVR commented Dec 13, 2011

When using the whenTapped method my view is retained and doesn't get released properly even if i use [myview whenTapped:nil];

when i remove my gestures manually:

for (UIGestureRecognizer *tempGesture in [self gestureRecognizers] )
[self removeGestureRecognizer:tempGesture];

after i set whenTapped to nil and i release my view it gets released properly.
maybe this should be done blockskit ? or maybe the problem exists somewhere else?

@zwaldowski
Copy link
Collaborator

Internally, the whenTapped: et. al. methods aren't setters; they just auto-initialize a UITapGestureRecognizer, which is noted in our documentation and will be clarified in the future. So calling [view whenTapped:nil] isn't useful.

UIGestureRecognizers shouldn't be retaining the view on release; that behavior isn't documented by Apple and it doesn't quite make sense. You should be autoreleasing (or in ARC, not doing anything at all) gesture recognizers as the view retains them. I've never seen it work any other way. All of this should be taken care of automatically unless you still have a reference to the gesture recognizer and/or view. I will investigate this further.

If you can't get it to work, my personal recommendation is to try setting up the gesture recognizers yourself using UIGestureRecognizer+BlocksKit. I'm not a huge fan of those methods myself, and I'll look into improving them.

Thank you for your support!

@ghost ghost assigned zwaldowski Dec 19, 2011
@zwaldowski
Copy link
Collaborator

Part of this is already being fixed in the experimental branch, and the rest I'll fix myself by 1.0. *EDIT: * Confirmed that the regular behavior of UIGestureRecognizer is as I said. Closing this for now. Please reopen if you continue to have issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants