Joe
Joe

Reputation: 4074

Is it recommended to remove gesture recogniser manually in iOS apps

I found mixed answer to this question whether we should manually remove the gesture recogniser or not. Can anyone provide the better understanding on this?

This says Yes: https://forums.xamarin.com/discussion/16970/gesturerecognizer-should-manually-remove

This says No:Do I need to release a gesture recognizer?

Suggestions please.

Upvotes: 0

Views: 814

Answers (1)

Pochi
Pochi

Reputation: 13459

If you are NOT talking about using Xamarin then:

No you don't, the answer on the second link you posted is right. The first link is talking about Xamarin, same rules don't apply.

This is how you attach a gesture recognizer. https://developer.apple.com/documentation/uikit/uiview/1622496-addgesturerecognizer

Under the "Discussion" part you can see this statement:

The view establishes a strong reference to the gesture recognizer.

Whenever you see this kind of statements it can be implied that "This object will keep my added object alive since it will strongly reference it". Thus, once the object disappears my added object will go with it.

Upvotes: 1

Related Questions