protected override void OnDetached() { if (effect?.Element == null) { return; } if ((Container as IVisualNativeElementRenderer)?.Control is UIButton button) { button.AllTouchEvents -= PreventButtonHighlight; } Container?.RemoveGestureRecognizer(gesture); gesture?.Dispose(); gesture = null; effect.Element = null; effect = null; }
protected override void OnDetached() { if (effect?.Element == null) { return; } if (((View as IVisualNativeElementRenderer)?.Control ?? View) is UIButton button) { button.AllTouchEvents -= PreventButtonHighlight; } View?.RemoveGestureRecognizer(touchGesture); View?.RemoveGestureRecognizer(hoverGesture); touchGesture?.Dispose(); hoverGesture?.Dispose(); touchGesture = null; hoverGesture = null; effect.Element = null; effect = null; }