当前位置: 首页>>代码示例>>C#>>正文


C# UIGestureRecognizer.LocationOfTouch方法代码示例

本文整理汇总了C#中UIGestureRecognizer.LocationOfTouch方法的典型用法代码示例。如果您正苦于以下问题:C# UIGestureRecognizer.LocationOfTouch方法的具体用法?C# UIGestureRecognizer.LocationOfTouch怎么用?C# UIGestureRecognizer.LocationOfTouch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIGestureRecognizer的用法示例。


在下文中一共展示了UIGestureRecognizer.LocationOfTouch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TransformingGestureDidBeginWithGesture

        void TransformingGestureDidBeginWithGesture(UIGestureRecognizer gesture)
        {
            inFullSizeMode = false;

            if (inTransformingState && gesture is UIPinchGestureRecognizer)
            {
                pinchGesture.Scale = 2.5f;
            }

            if (inTransformingState)
            {
                inTransformingState = false;
                transformingItem.SwitchToFullSizeMode(false);
                CGAffineTransform newTransform = CGAffineTransform.MakeScale(2.5f, 2.5f);
                transformingItem.ContentView.Transform = newTransform;
                transformingItem.ContentView.Center = transformingItem.FullSizeView.Center;
            }
            else if (transformingItem==null)
            {
                PointF locationTouch = gesture.LocationOfTouch(0,this);
                int positionTouch = layoutStrategy.ItemPositionFromLocation(locationTouch);
                TransformingGestureDidBeginAtPosition(positionTouch);
            }
        }
开发者ID:skela,项目名称:GMGridView,代码行数:24,代码来源:GridView.cs

示例2: ShouldBegin

        public bool ShouldBegin(UIGestureRecognizer gestureRecognizer)
        {
            bool valid = true;
            bool isScrolling = Dragging || Decelerating;

            if (gestureRecognizer == tapGesture)
            {
                if (editing && disableEditOnEmptySpaceTap)
                {
                    PointF locationTouch = tapGesture.LocationInView(this);
                    int position = layoutStrategy.ItemPositionFromLocation(locationTouch);

                    valid = (position == GMGV_INVALID_POSITION);
                }
                else
                {
                    valid = !isScrolling && !editing && !longPressGesture.HasRecognizedValidGesture();
                }
            }
            else if (gestureRecognizer == longPressGesture)
            {
                valid = (sortingDelegate!=null || enableEditOnLongPress) && !isScrolling && !editing;
            }
            else if (gestureRecognizer == sortingPanGesture)
            {
                valid = (sortMovingItem != null && longPressGesture.HasRecognizedValidGesture());
            }
            else if(gestureRecognizer == rotationGesture || gestureRecognizer == pinchGesture || gestureRecognizer == panGesture)
            {
                if (transformDelegate != null && gestureRecognizer.NumberOfTouches == 2)
                {
                    PointF locationTouch1 = gestureRecognizer.LocationOfTouch(0,this);
                    PointF locationTouch2 = gestureRecognizer.LocationOfTouch(1,this);

                    int positionTouch1 = layoutStrategy.ItemPositionFromLocation(locationTouch1);
                    int positionTouch2 = layoutStrategy.ItemPositionFromLocation(locationTouch2);

                    valid = !editing && (IsInTransformingState || ((positionTouch1 == positionTouch2) && (positionTouch1 != GMGV_INVALID_POSITION)));
                }
                else
                {
                    valid = false;
                }
            }

            return valid;
        }
开发者ID:skela,项目名称:GMGridView,代码行数:47,代码来源:GridView.cs


注:本文中的UIGestureRecognizer.LocationOfTouch方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。