SHARE
TWEET

Untitled

a guest Jan 12th, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
  2.         {
  3.       base.OnElementChanged(e);
  4.             var customButton = e.NewElement as ChatButtonImage;
  5.             var thisButton = new CutomUIImageView(customButton, Control.Image);
  6.             thisButton.UserInteractionEnabled = true;
  7.             this.UserInteractionEnabled = true;
  8.       var longPress = new UILongPressGestureRecognizer();
  9.             longPress.AddTarget((obj) =>
  10.             {
  11.                 var ui = obj as UIGestureRecognizer;
  12.  
  13.                 if (ui.State == UIGestureRecognizerState.Began)
  14.                 {
  15.                     customButton.OnPressed();
  16.  
  17.                 }
  18.                 else if (ui.State == UIGestureRecognizerState.Ended)
  19.                 {
  20.                     customButton.OnReleased();
  21.                 }
  22.                 else
  23.                 {
  24.                 }
  25.             });
  26.             (this as UIView).AddGestureRecognizer(longPress);
  27. }
RAW Paste Data
Top