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


C# UITapGestureRecognizer.RequireGestureRecognizerToFail方法代码示例

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


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

示例1: Initialize

		private void Initialize ()
		{
			AutoresizingMask = UIViewAutoresizing.All;

			ivMain = new UIImageView ();
			//			ivMain.AutoresizingMask = UIViewAutoresizing.All;
			ivMain.ContentMode = UIViewContentMode.ScaleAspectFit;
			//			ivMain.BackgroundColor = UIColor.Red; // DEBUG
			AddSubview (ivMain);

			// Setup zoom
			MaximumZoomScale = maxZoom;
			MinimumZoomScale = minZoom;
			ShowsVerticalScrollIndicator = false;
			ShowsHorizontalScrollIndicator = false;
			BouncesZoom = true;
			ViewForZoomingInScrollView += (UIScrollView sv) => {
				return ivMain;
			};

			// Setup gestures
			grTap = new UITapGestureRecognizer (() => {
				if (OnSingleTap != null) {
					OnSingleTap();
				}
			});
			grTap.NumberOfTapsRequired = 1;
			AddGestureRecognizer (grTap);

			grDoubleTap = new UITapGestureRecognizer (() => {
				if (ZoomScale >= defaultZoom) {
					SetZoomScale (sizeToFitZoom, true);
				} else {
					//SetZoomScale (defaultZoom, true);

					// Zoom to user specified point instead of center
					var point = grDoubleTap.LocationInView(grDoubleTap.View);
					var zoomRect = GetZoomRect(defaultZoom, point);
					ZoomToRect(zoomRect, true);
				}
			});
			grDoubleTap.NumberOfTapsRequired = 2;
			AddGestureRecognizer (grDoubleTap);

			// To use single tap and double tap gesture recognizers together. See for reference:
			// http://stackoverflow.com/questions/8876202/uitapgesturerecognizer-single-tap-and-double-tap
			grTap.RequireGestureRecognizerToFail (grDoubleTap);
		}
开发者ID:EckyZero,项目名称:Hashtagg,代码行数:48,代码来源:UIScrollViewImage.cs

示例2: Initialize


//.........这里部分代码省略.........
                panGesture.ShouldBeRequiredToFailBy = (a, b) =>
                {
                    return false;
                };
                this.AddGestureRecognizer(panGesture);

                var pinchGesture = new UIPinchGestureRecognizer(Pinch);
                pinchGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) =>
                {
                    return true;
                };
                // TODO: workaround for xamarin bug, remove later!
                pinchGesture.ShouldRequireFailureOf = (a, b) =>
                {
                    return false;
                };
                pinchGesture.ShouldBeRequiredToFailBy = (a, b) =>
                {
                    return false;
                };
                this.AddGestureRecognizer(pinchGesture);

                var rotationGesture = new UIRotationGestureRecognizer(Rotate);
                rotationGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) =>
                {
                    return true;
                };
                // TODO: workaround for xamarin bug, remove later!
                rotationGesture.ShouldRequireFailureOf = (a, b) =>
                {
                    return false;
                };
                rotationGesture.ShouldBeRequiredToFailBy = (a, b) =>
                {
                    return false;
                };
                this.AddGestureRecognizer(rotationGesture);

                var singleTapGesture = new UITapGestureRecognizer(SingleTap);
                singleTapGesture.NumberOfTapsRequired = 1;
                // TODO: workaround for xamarin bug, remove later!
                //				singleTapGesture.ShouldRequireFailureOf = (a, b) => { return false; };
                //				singleTapGesture.ShouldBeRequiredToFailBy = (a, b) => { return false; };

                var doubleTapGesture = new UITapGestureRecognizer(DoubleTap);
                doubleTapGesture.NumberOfTapsRequired = 2;
                // TODO: workaround for xamarin bug, remove later!
                //				doubleTapGesture.ShouldRequireFailureOf = (a, b) => { return false; };
                //				doubleTapGesture.ShouldBeRequiredToFailBy = (a, b) => { return false; };

                //singleTapGesture.RequireGestureRecognizerToFail (doubleTapGesture);
                this.AddGestureRecognizer(singleTapGesture);
                this.AddGestureRecognizer(doubleTapGesture);
            }
            else
            {
                var panGesture = new UIPanGestureRecognizer(Pan);
                panGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) =>
                {
                    return true;
                };
                this.AddGestureRecognizer(panGesture);

                var pinchGesture = new UIPinchGestureRecognizer(Pinch);
                pinchGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) =>
                {
                    return true;
                };
                this.AddGestureRecognizer(pinchGesture);

                var rotationGesture = new UIRotationGestureRecognizer(Rotate);
                rotationGesture.ShouldRecognizeSimultaneously += (UIGestureRecognizer r, UIGestureRecognizer other) =>
                {
                    return true;
                };
                this.AddGestureRecognizer(rotationGesture);

                var singleTapGesture = new UITapGestureRecognizer(SingleTap);
                singleTapGesture.NumberOfTapsRequired = 1;
                //singleTapGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneouslySingle;
                //singleTapGesture.ShouldBeRequiredToFailBy += ShouldRecognizeSimultaneouslySingle;

                var doubleTapGesture = new UITapGestureRecognizer(DoubleTap);
                doubleTapGesture.NumberOfTapsRequired = 2;
                //doubleTapGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneouslySingle;
                //doubleTapGesture.ShouldBeRequiredToFailBy += ShouldRecognizeSimultaneouslyDouble;

                singleTapGesture.RequireGestureRecognizerToFail(doubleTapGesture);
                this.AddGestureRecognizer(singleTapGesture);
                this.AddGestureRecognizer(doubleTapGesture);
            }

            // set scalefactor.
            _scaleFactor = (float)this.ContentScaleFactor;

            // create the cache renderer.
            _cacheRenderer = new MapRenderer<CGContextWrapper>(
                new CGContextRenderer(_scaleFactor));
            _backgroundColor = SimpleColor.FromKnownColor(KnownColor.White).Value;
        }
开发者ID:UnifyKit,项目名称:OsmSharp,代码行数:101,代码来源:MapView.cs

示例3: AddMultipleGesture

        private void AddMultipleGesture()
        {
            UITapGestureRecognizer twoFingerTapGesture = new UITapGestureRecognizer(this, new Selector("DidTwoFingerTap:"));
            twoFingerTapGesture.NumberOfTapsRequired = 1;
            twoFingerTapGesture.NumberOfTouchesRequired = 2;
            scrollView.AddGestureRecognizer(twoFingerTapGesture);

            UITapGestureRecognizer singleTapGesture = new UITapGestureRecognizer(this, new Selector("DidSingleTap:"));
            singleTapGesture.NumberOfTapsRequired = 1;
            singleTapGesture.NumberOfTouchesRequired = 1;
            scrollView.AddGestureRecognizer(singleTapGesture);

            UITapGestureRecognizer doubleTapRecognizer = new UITapGestureRecognizer(this, new Selector("DidDoubleTap:"));
            doubleTapRecognizer.NumberOfTapsRequired = 2;
            doubleTapRecognizer.NumberOfTouchesRequired = 1;
            scrollView.AddGestureRecognizer(doubleTapRecognizer);

            singleTapGesture.RequireGestureRecognizerToFail(doubleTapRecognizer);
            scrollView.MinimumZoomScale = 1f;
            scrollView.MaximumZoomScale = 2.5f;

            CenterScrollViewContents();
        }
开发者ID:anhvule,项目名称:MHFacebookImageViewer.Xamarin,代码行数:23,代码来源:ImageViewer.cs

示例4: Setup

		void Setup ()
		{
			SceneView = (SCNView)this.View;

			SceneView.BackgroundColor = SKColor.Black;

			//setup ivars
			Boxes = new List<SCNNode> ();

			//setup the scene
			SetupScene ();

			//present it
			SceneView.Scene = Scene;

			//tweak physics
			SceneView.Scene.PhysicsWorld.Speed = 2.0f;

			//let's be the delegate of the SCNView
			SceneView.WeakSceneRendererDelegate = this;

			SceneView.JitteringEnabled = true;

			//initial point of view
			SceneView.PointOfView = CameraNode;

			//setup overlays
			var overlay = new SpriteKitOverlayScene (SceneView.Bounds.Size);
			SceneView.OverlayScene = overlay;

			#if __IOS__
			var gestureRecognizers = new List<UIGestureRecognizer> ();
			if (SceneView.GestureRecognizers != null)
				gestureRecognizers.AddRange (SceneView.GestureRecognizers);

			// add a tap gesture recognizer
			UITapGestureRecognizer tapGesture = new UITapGestureRecognizer (HandleTouch);

			// add a pan gesture recognizer
			UIPanGestureRecognizer panGesture = new UIPanGestureRecognizer (HandleTouchPan);

			// add a double tap gesture recognizer
			UITapGestureRecognizer doubleTapGesture = new UITapGestureRecognizer (HandleDoubleTouch);
			doubleTapGesture.NumberOfTapsRequired = 2;

			tapGesture.RequireGestureRecognizerToFail (panGesture);

			gestureRecognizers.Add (doubleTapGesture);
			gestureRecognizers.Add (tapGesture);
			gestureRecognizers.Add (panGesture);

			//register gesture recognizers
			SceneView.GestureRecognizers = gestureRecognizers.ToArray ();
			#endif
		}
开发者ID:W3SS,项目名称:mac-ios-samples,代码行数:55,代码来源:GameViewController.cs

示例5: SetupImageModeGestureRecognizers

        private void SetupImageModeGestureRecognizers()
        {
            UITapGestureRecognizer doubleTapper = null;
            doubleTapper = new UITapGestureRecognizer (ImageDoubleTapped);
            doubleTapper.NumberOfTapsRequired = 2;
            doubleTapper.WeakDelegate = this;
            DoubleTapperPhoto = doubleTapper;

            UILongPressGestureRecognizer longPresser = new UILongPressGestureRecognizer (ImageLongPressed);
            longPresser.WeakDelegate = this;
            LongPresserPhoto = longPresser;

            UITapGestureRecognizer singleTapper = null;
            singleTapper = new UITapGestureRecognizer (ImageSingleTapped);
            singleTapper.RequireGestureRecognizerToFail (doubleTapper);
            singleTapper.RequireGestureRecognizerToFail (longPresser);
            singleTapper.WeakDelegate = this;
            SingleTapperPhoto = singleTapper;

            UIPanGestureRecognizer panner = new UIPanGestureRecognizer (dismissingPanGestureRecognizerPanned);
            panner.WeakDelegate = this;
            ScrollView.AddGestureRecognizer (panner);
            PanRecognizer = panner;

            View.AddGestureRecognizer (singleTapper);
            View.AddGestureRecognizer (doubleTapper);
            View.AddGestureRecognizer (longPresser);
        }
开发者ID:Amplify-Social,项目名称:JTSImageViewControllerCSharp,代码行数:28,代码来源:JTSImageViewController.cs


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