protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged (e); if (e.NewElement is MyImage) { image = e.NewElement as MyImage; this.Control.Touch += OnTouchImageView; } }
protected override void OnElementChanged(ElementChangedEventArgs<Image> e) { base.OnElementChanged (e); if (e.NewElement is MyImage) { image = e.NewElement as MyImage; UIView view = this as UIView; view.UserInteractionEnabled = true; UISwipeGestureRecognizer gestureRecognizerLeft = new UISwipeGestureRecognizer (() => { image.SwipedLeft(); }); gestureRecognizerLeft.Direction = UISwipeGestureRecognizerDirection.Left; UISwipeGestureRecognizer gestureRecognizerRight = new UISwipeGestureRecognizer (() => { image.SwipedRight(); }); gestureRecognizerRight.Direction = UISwipeGestureRecognizerDirection.Right; view.AddGestureRecognizer (gestureRecognizerLeft); view.AddGestureRecognizer (gestureRecognizerRight); } }