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


C# UITapGestureRecognizer.LocationOfTouch方法代码示例

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


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

示例1: ViewDidLoad

        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);
        }
开发者ID:patridge,项目名称:UIKitAbuse,代码行数:30,代码来源:PlacingViewsViewController.cs

示例2: WireUpTapGestureRecognizer

		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);
		}
开发者ID:rojepp,项目名称:monotouch-samples,代码行数:13,代码来源:GestureRecognizers_iPhone.xib.cs

示例3: OnTapOutside

		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));
				}
			}
		}
开发者ID:dtimyr,项目名称:xamarin,代码行数:17,代码来源:ModalMenuPickerViewController.cs

示例4: AddTag

        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();
        }
开发者ID:KuroiAme,项目名称:Indexer,代码行数:14,代码来源:TagListController.cs


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