void ExpandMenu(UITapGestureRecognizer gesture)
 {
     if (gesture.LocationOfTouch(0, gesture.View).Y <= 40f)
     {
         SlideAndFix(gesture);
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            View.BackgroundColor = UIColor.White;
            View.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            // Adjust taps/touches required to fit your needs.
            UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer() {
                NumberOfTapsRequired = 1,
                NumberOfTouchesRequired = 1,
            };
            tapRecognizer.AddTarget((sender) => {
                // The foreach is only necessary if you have more than one touch for your recognizer.
                // For all else just roll with zero, `PointF location = tapRecognizer.LocationOfTouch(0, View);`
                foreach (int locationIndex in Enumerable.Range(0, tapRecognizer.NumberOfTouches)) {
                    PointF location = tapRecognizer.LocationOfTouch(locationIndex, View);
                    UIView newTapView = new UIView(new RectangleF(PointF.Empty, ItemSize)) {
                        BackgroundColor = GetRandomColor(),
                    };
                    newTapView.Center = location;
                    View.Add(newTapView);
                    // Remove the view after it's been around a while.
                    Task.Delay(5000).ContinueWith(_ => InvokeOnMainThread(() => {
                        newTapView.RemoveFromSuperview();
                        newTapView.Dispose();
                    }));
                }
            });
            View.AddGestureRecognizer(tapRecognizer);
        }
        private void WireUpTapGestureRecognizer()
        {
            // Create a new tap gesture
            UITapGestureRecognizer tapGesture = null;

            // Report touch
            Action action = () => {
                TouchStatus.Text = string.Format("Image touched at: {0}", tapGesture.LocationOfTouch(0, DoubleTouchImage));

                // Toggle the image
                if (imageHighlighted)
                {
                    DoubleTouchImage.Image = UIImage.FromBundle("DoubleTapMe.png");
                }
                else
                {
                    DoubleTouchImage.Image = UIImage.FromBundle("DoubleTapMe_Highlighted.png");
                }
                imageHighlighted = !imageHighlighted;
            };

            tapGesture = new UITapGestureRecognizer(action);

            // Configure it
            tapGesture.NumberOfTapsRequired = 2;

            // Add the gesture recognizer to the view
            DoubleTouchImage.AddGestureRecognizer(tapGesture);
        }
示例#4
0
 private void TapGestureRecognizerAction()
 {
     if (FormsView != null && tapGestureRecognizer != null)
     {
         var location = tapGestureRecognizer.LocationOfTouch(0, this);
         FormsView.OnTapped((float)location.X, (float)location.Y);
     }
 }
示例#5
0
        void HandleTap(UITapGestureRecognizer recognizer)
        {
            //state doesnt matter here, only executed if tap gesture
            var loc            = recognizer.LocationOfTouch(0, recognizer.View);
            var touchAnimation = new RandomTouch(_currentTriangulation, 6, (float)(loc.X * UIScreen.MainScreen.Scale), (float)(loc.Y * UIScreen.MainScreen.Scale), 250);

            _polyLibViewRef.AddAnimation(touchAnimation);
        }
示例#6
0
        private void Action(UITapGestureRecognizer gestureRecognizer)
        {
            var p = gestureRecognizer.LocationOfTouch(0, view);

            pointSubject.OnNext(new PointerInput()
            {
                Point = new Point(p.X, p.Y), PrimaryButtonStatus = PointerStatus.Down
            });
        }
示例#7
0
        void OnTapped(UITapGestureRecognizer re)
        {
            var point = re.LocationOfTouch(re.NumberOfTouches, this);
            //tategumiView.SendTap ();

            bool res = tategumiView.NextPage();

            if (res == true)
            {
                SetNeedsDisplay(); //再描画
            }
        }
		protected void WireUpTapGestureRecognizer ()
		{
			// create a new tap gesture
			UITapGestureRecognizer tapGesture = new UITapGestureRecognizer ();
			// wire up the event handler (have to use a selector)
			tapGesture.AddTarget ( () => {
				lblGestureStatus.Text = "tap me image tapped @" + tapGesture.LocationOfTouch (0, imgTapMe).ToString ();
			});
			// configure it
			tapGesture.NumberOfTapsRequired = 2;
			// add the gesture recognizer to the view
			imgTapMe.AddGestureRecognizer (tapGesture);
		}
        protected void WireUpTapGestureRecognizer()
        {
            // create a new tap gesture
            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer();

            // wire up the event handler (have to use a selector)
            tapGesture.AddTarget(() => {
                lblGestureStatus.Text = "tap me image tapped @" + tapGesture.LocationOfTouch(0, imgTapMe).ToString();
            });
            // configure it
            tapGesture.NumberOfTapsRequired = 2;
            // add the gesture recognizer to the view
            imgTapMe.AddGestureRecognizer(tapGesture);
        }
        protected void WireUpTapGestureRecognizer()
        {
            // create a new tap gesture
            UITapGestureRecognizer tapGesture = null;

            NSAction action = () => {
                lblGestureStatus.Text = "tap me image tapped @" + tapGesture.LocationOfTouch(0, imgTapMe).ToString();
            };

            tapGesture = new UITapGestureRecognizer(action);
            // configure it
            tapGesture.NumberOfTapsRequired = 2;
            // add the gesture recognizer to the view
            imgTapMe.AddGestureRecognizer(tapGesture);
        }
示例#11
0
        private void OnTap()
        {
            // Find word at tap location
            var tapLocation = tapGesture.LocationOfTouch(0, this);

            // Correct for frame
            tapLocation = new PointF(tapLocation.X, Frame.Height - tapLocation.Y);

            var word = FindWordAtLocation(tapLocation);

            if (word != null && word.Value.Action != null)
            {
                word.Value.Action();
            }
        }
示例#12
0
 private void GestureAction(UITapGestureRecognizer tap)
 {
     try
     {
         var touchLocation = tap.LocationOfTouch(0, CollectionResult);
         var indexP        = CollectionResult.IndexPathForItemAtPoint(touchLocation);
         var index         = (int)indexP.Item;
         if (index >= 0 && index < ResultItems.Count)
         {
             RemoveItem(index);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
示例#13
0
        public void TapAction(UITapGestureRecognizer gestureRecognizer)
        {
            var location = gestureRecognizer.LocationOfTouch(0, scnView);
            var hits     = scnView.HitTest(location, new SCNHitTestOptions());

            if (hits.Count() != 0)
            {
                var tappedNodeName = hits.FirstOrDefault().Node.Name;

                UIAlertView alert = new UIAlertView()
                {
                    Title   = tappedNodeName,
                    Message = "You found a " + tappedNodeName
                };
                alert.AddButton("OK");
                alert.Show();
            }
        }
 public void HandleTap(UITapGestureRecognizer recognizer)
 {
     this.lblGestureStatus.Text = "tap me image tapped @" + recognizer.LocationOfTouch(0, this.imgTapMe).ToString();
 }
		private void OnTapOutside(UITapGestureRecognizer recogniser)
		{

			if (recogniser.State == UIGestureRecognizerState.Ended)
			{
				var window = View.Window;
				var viewLoc = recogniser.LocationOfTouch (0, View);

				var width = _parent.View.Frame.Width * 3/4;
				//var height = _parent.View.Frame.Height - 65;

				//if (!this.View.PointInside (viewLoc, null)) {
				if (viewLoc.X > width) {
					DismissViewController (true, () => window.RemoveGestureRecognizer (_dismissRecognizer));
				}
			}
		}
示例#16
0
        void AddTag(UITapGestureRecognizer gestureRecognizer)
        {
            Console.WriteLine ("addsubtag()");

            UIAlertView av = new UIAlertView ("input tags, comma seperated", "\n", null, "Cancel", new string[] {"Create"});
            Console.WriteLine(gestureRecognizer.LocationOfTouch (0, tlv));
            av.AlertViewStyle = UIAlertViewStyle.PlainTextInput;
            av.Clicked += (object sender, UIButtonEventArgs e) => {
                String tagText = av.GetTextField (0).Text;
                saveTagText (tagText);
            };

            av.Show();
        }
示例#17
0
        private void tapped(UITapGestureRecognizer g)
        {
            var position = g.LocationOfTouch(0, this.View);

            addNewBall(position.X, position.Y);
        }