Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why gesture recognizer outlets are strong by default

Tags:

ios

When you create an outlet for a control by Ctrl-dragging in Interface Builder it usually suggests to make the outlet weak.

But if you create an outlet for a gesture recognizer the suggestion is to make it strong. I am curious what is the reason behind of this, what is wrong with making gesture recognizer outlets weak too?

like image 821
yurish Avatar asked Jul 25 '13 11:07

yurish


1 Answers

ref: http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=5126

From ios 5.0 it does not retain the gesture recognizers when added to a view controller.

By making strong properties and connecting them to the gesture recognizers, you can ensure that they stay alive otherwise the app will crash.

Credit to Ray Wenderlich team member Hollance.

like image 110
prasad Avatar answered Oct 19 '22 22:10

prasad