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


C# UIPanGestureRecognizer.AddTarget方法代码示例

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


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

示例1: SlideoutNavigationController

        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 245f;
            // HACK to detect pan gesture from the whole viewport
            SlideHeight = float.MaxValue;
            LayerShadowing = false;

            _internalMenuViewLeft = new ProxyNavigationController {
                ParentController = this,
                View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };
            _internalMenuViewRight = new ProxyNavigationController {
                ParentController = this,
                View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };

            _internalMenuViewLeft.SetNavigationBarHidden (DisplayNavigationBarOnLeftMenu, false);
            _internalMenuViewRight.SetNavigationBarHidden (DisplayNavigationBarOnRightMenu, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer ();
            _tapGesture.AddTarget (() => Hide ());
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer {
                Delegate = new SlideoutPanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget (() => Pan (_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer (_panGesture);
        }
开发者ID:jgrozdanov,项目名称:mono-sport,代码行数:38,代码来源:SlideoutNavigationController.cs

示例2: SlideoutNavigationController

        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 260f;
            SlideHeight = 44f;
            LayerShadowing = true;

            _internalMenuView = new ProxyNavigationController
                                    {
                                        ParentController = this,
                                        View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
                                    };
            //_internalMenuView.SetNavigationBarHidden(true, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer();
            //            _tapGesture.AddTarget(new )
            _tapGesture.AddTarget(Hide);
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer
                              {
                                  Delegate = new SlideoutPanDelegate(this),
                                  MaximumNumberOfTouches = 1,
                                  MinimumNumberOfTouches = 1
                              };
            _panGesture.AddTarget(() => Pan(_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer(_panGesture);
        }
开发者ID:sinhpham,项目名称:Harvest_Loss,代码行数:34,代码来源:SlideoutNavigationController.cs

示例3: WireUpDragGestureRecognizer

 protected void WireUpDragGestureRecognizer()
 {
     // create a new tap gesture
     UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();
     // wire up the event handler (have to use a selector)
     gesture.AddTarget(() => HandleDrag(gesture));
     // add the gesture recognizer to the view
     imgDragMe.AddGestureRecognizer(gesture);
 }
开发者ID:Adameg,项目名称:mobile-samples,代码行数:9,代码来源:GestureRecognizers_iPhone.xib.cs

示例4: WireUpDragGestureRecognizer

		private void WireUpDragGestureRecognizer()
		{
			// Create a new tap gesture
			UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();

			// Wire up the event handler (have to use a selector)
			gesture.AddTarget(() => HandleDrag(gesture));

			// Add the gesture recognizer to the view
			DragImage.AddGestureRecognizer(gesture);
		}
开发者ID:Rajneesh360Logica,项目名称:monotouch-samples,代码行数:11,代码来源:GestureViewController.cs

示例5: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            IsOpen = true;

            var containerFrame = View.Bounds;
            containerFrame.X = View.Bounds.Width;
            ContainerView.Frame = containerFrame;
            ContainerView.BackgroundColor = UIColor.White;
            ContainerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            View.BackgroundColor = UIColor.White;

            _tapGesture = new UITapGestureRecognizer();
            _tapGesture.AddTarget (() => Close(true));
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer {
                Delegate = new PanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget (() => Pan (ContainerView));
            ContainerView.AddGestureRecognizer(_panGesture);

            if (_menuViewController != null)
                SetMenuViewController(_menuViewController, false);
            if (_mainViewController != null)
                SetMainViewController(_mainViewController, false);

            //Create some shadowing
            if (ShadowEnabled)
            {
                ContainerView.Layer.ShadowOffset = new SizeF(-5, 0);
                ContainerView.Layer.ShadowPath = UIBezierPath.FromRect(ContainerView.Bounds).CGPath;
                ContainerView.Layer.ShadowRadius = 3.0f;
                ContainerView.Layer.ShadowColor = UIColor.Black.CGColor;
            }
        }
开发者ID:kirandocperfect,项目名称:MonoTouch.SlideoutNavigation,代码行数:40,代码来源:SlideoutNavigationController.cs

示例6: SetupGestureRecognizers

		private void SetupGestureRecognizers() {
			TapGesture = new UITapGestureRecognizer ();
			TapGesture.AddTarget (() => CloseMenu());
			TapGesture.NumberOfTapsRequired = 1;
			PanGesture = new UIPanGestureRecognizer {
				Delegate = new SlideoutPanDelegate(),
				MaximumNumberOfTouches = 1,
				MinimumNumberOfTouches = 1
			};
			PanGesture.AddTarget(() => Pan());
		}
开发者ID:cocoageek,项目名称:Xamarin-Framework-Samples,代码行数:11,代码来源:Sidebar.cs

示例7: AttachTouchEvents

		private void AttachTouchEvents ()
		{

			panGesture = new UIPanGestureRecognizer ();

			panGesture.AddTarget (() => { 				
				PanGestureMoveAround (panGesture);
			});
			panGesture.MaximumNumberOfTouches = 2;
			this.AddGestureRecognizer (panGesture);
		}
开发者ID:TheJaniceTong,项目名称:Judo-Xamarin,代码行数:11,代码来源:SlideUpMenu.cs

示例8: ChangeContentView

 /// <summary>
 /// Replaces the content area view controller with the specified view controller.
 /// </summary>
 /// <param name="newContentView">
 /// New content view.
 /// </param>
 public void ChangeContentView(UIViewController newContentView)
 {
     if (_contentAreaView != null)
         _contentAreaView.RemoveFromSuperview();
     ContentAreaController = newContentView;
     CloseMenu(true);
     SetVisibleView();
     // setup a tap gesture to close the menu on root view tap
     _tapGesture = new UITapGestureRecognizer ();
     _tapGesture.AddTarget (() => CloseMenu());
     _tapGesture.NumberOfTapsRequired = 1;
     _panGesture = new UIPanGestureRecognizer {
         Delegate = new SlideoutPanDelegate(this),
         MaximumNumberOfTouches = 1,
         MinimumNumberOfTouches = 1
     };
     _panGesture.AddTarget (() => Pan (_contentAreaView));
     _contentAreaView.AddGestureRecognizer(_panGesture);
 }
开发者ID:GSerjo,项目名称:Xamarin-Sidebar,代码行数:25,代码来源:SidebarController.cs

示例9: Register

		private static void Register(View view, UIView uiview)
		{
			foreach (var elementsGestureRecognizer in view.GestureRecognizers)
			{
				TypeSwitch.Do(elementsGestureRecognizer,

					TypeSwitch.Case<XF.GestureRecognizers.TapGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UITapGestureRecognizer
							{
								NumberOfTapsRequired = gestureRecognizer.NumberOfTaps,
								NumberOfTouchesRequired = gestureRecognizer.NumberOfTouches,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_TapGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<LongPressGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UILongPressGestureRecognizer
							{
								NumberOfTapsRequired = gestureRecognizer.NumberOfTaps,
								NumberOfTouchesRequired = gestureRecognizer.NumberOfTouches,
								MinimumPressDuration = gestureRecognizer.MinimumDuration,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_LongPressGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<PanGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UIPanGestureRecognizer
							{
								MaximumNumberOfTouches = gestureRecognizer.MaximumNumberOfTouches,
								MinimumNumberOfTouches = gestureRecognizer.MinimumNumberOfTouches,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_PanGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<XF.GestureRecognizers.PinchGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UIPinchGestureRecognizer
							{
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_PinchGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<SwipeGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UISwipeGestureRecognizer
							{
								Direction = (UISwipeGestureRecognizerDirection)gestureRecognizer.Direction,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_SwipeGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
//.........这里部分代码省略.........
开发者ID:AndriiTsok,项目名称:Xamarin.Forms.GestureRecognizers,代码行数:101,代码来源:iOS_GestureRecognizersContainer.cs


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