是否建议在 iOS 个应用程序中手动删除手势识别器
Is it recommended to remove gesture recogniser manually in iOS apps
对于这个问题,我们是否应该手动删除手势识别器,我发现答案不一。谁能对此提供更好的理解?
这表示是:https://forums.xamarin.com/discussion/16970/gesturerecognizer-should-manually-remove
这表示否:Do I need to release a gesture recognizer?
请多多指教。
如果您不是在谈论使用 Xamarin,那么:
不,你没有,你发布的第二个 link 的答案是正确的。第一个 link 是在谈论 Xamarin,同样的规则不适用。
这就是您附加手势识别器的方式。
https://developer.apple.com/documentation/uikit/uiview/1622496-addgesturerecognizer
在"Discussion"部分可以看到这样的语句:
The view establishes a strong reference to the gesture recognizer.
只要你看到这种说法,就可以暗示"This object will keep my added object alive since it will strongly reference it"。因此,一旦对象消失,我添加的对象将随之消失。
对于这个问题,我们是否应该手动删除手势识别器,我发现答案不一。谁能对此提供更好的理解?
这表示是:https://forums.xamarin.com/discussion/16970/gesturerecognizer-should-manually-remove
这表示否:Do I need to release a gesture recognizer?
请多多指教。
如果您不是在谈论使用 Xamarin,那么:
不,你没有,你发布的第二个 link 的答案是正确的。第一个 link 是在谈论 Xamarin,同样的规则不适用。
这就是您附加手势识别器的方式。 https://developer.apple.com/documentation/uikit/uiview/1622496-addgesturerecognizer
在"Discussion"部分可以看到这样的语句:
The view establishes a strong reference to the gesture recognizer.
只要你看到这种说法,就可以暗示"This object will keep my added object alive since it will strongly reference it"。因此,一旦对象消失,我添加的对象将随之消失。