コード例 #1
0
        public override void TouchesEnded(Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);
            var touch = touches.AnyObject as UITouch;

            if (touch == null || nodeIsMoving == false || currentMovingNode == null)
            {
                return;
            }

            if (DropableCanvas.Frame.Contains(currentMovingNode.Center) == true)
            {
                //Remove this view from superview
                currentMovingNode.RemoveFromSuperview();

                binarySearchTreeView.InsertNode(int.Parse(currentMovingNode.Text));
            }
            else
            {
                currentMovingNode.Frame = currentMovingNodeOriginalPosition;
            }

            currentMovingNode = null;
            currentMovingNodeOriginalPosition = CGRect.Empty;
            nodeIsMoving = false;
        }