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


C# UIEvent.TouchesForView方法代码示例

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


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

示例1: TouchesBegan

        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            try
            {
                if (evt.TouchesForView (this).Count > 1)
                    multipleTouches = true;
                if (evt.TouchesForView (this).Count > 2)
                    twoFingerTapIsPossible = true;
            }
            catch
            {

            }
            base.TouchesBegan (touches, evt);
        }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:15,代码来源:TapableView.cs

示例2: TouchesEnded

        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            try
            {
                bool allTouchesEnded = (touches.Count == evt.TouchesForView (this).Count);

                // first check for plain single/double tap, which is only possible if we haven't seen multiple touches
                if (!multipleTouches)
                {
                    var touch = (UITouch)touches.AnyObject;
                    // tapLocation = touch.LocationInView(this);
                    if (touch.TapCount == 1)
                    {
                        if (Tapped != null)
                            Tapped (this);
                    }
                    else if (touch.TapCount == 2)
                    {
                        if (DoubleTapped != null)
                            DoubleTapped (this);
                    }
                }
            }
            catch
            {
            }
            base.TouchesEnded (touches, evt);
        }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:28,代码来源:TapableView.cs

示例3: GetLocation

		public static Point GetLocation (UIView view, UIEvent theEvent)
		{
			var touches = theEvent.TouchesForView (view);
			var touch = touches.ToArray<UITouch> ().FirstOrDefault ();
			var loc = touch.LocationInView (view);
			loc.Y = view.Frame.Height - loc.Y;
			return loc.ToEtoPoint ();
		}
开发者ID:JohnACarruthers,项目名称:Eto,代码行数:8,代码来源:Conversions.cs

示例4: TouchesBegan

        public override void TouchesBegan(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesBegan (touches, evt);

            //Check for touches in the movers
            if (evt.TouchesForView(_topLeft) != null)
            {
                _dragView = _topLeft;
            }
            else if (evt.TouchesForView(_bottomRight) != null)
            {
                _dragView = _bottomRight;
            }
            else if (evt.TouchesForView(this) != null)
            {
                _dragView = this;
            }

            if (_dragView != null)
                _location = ((UITouch)evt.TouchesForView(_dragView).AnyObject).LocationInView(_dragView);
        }
开发者ID:GSerjo,项目名称:appreciateui,代码行数:21,代码来源:CropView.cs

示例5: HandleTouches

        private void HandleTouches(NSSet touches, UIEvent evt)
        {
            var touch = (UITouch)evt.TouchesForView(this).AnyObject;
            var pos = touch.LocationInView(this);

            var p = pos.X;
            var b = Frame.Size.Width;

            if (p < 0)
                Hue = 0;
            else if (p > b)
                Hue = 1;
            else
                Hue = p / b;

            OnHueChanged();
        }
开发者ID:mattleibow,项目名称:AdvancedColorPicker,代码行数:17,代码来源:HuePickerView.cs

示例6: TouchesEnded

        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            bool allTouchesEnded = (touches.Count == evt.TouchesForView (this).Count);

            // first check for plain single/double tap, which is only possible if we haven't seen multiple touches
            if (!multipleTouches) {
                var touch = (UITouch)touches.AnyObject;
                // tapLocation = touch.LocationInView(this);
                var myParentView = ParentView as CalendarDayTimelineView;
                if (touch.TapCount == 1) {
                    if (myParentView != null) {
                        if (myParentView.OnEventClicked != null)
                            myParentView.OnEventClicked (this);
                    } else if (OnEventClicked != null)
                        OnEventClicked (this);
                } else if (touch.TapCount == 2) {
                    if (myParentView != null) {
                        if (myParentView.OnEventDoubleClicked != null)
                            myParentView.OnEventDoubleClicked (this);
                    } else if (OnEventDoubleClicked != null)
                        OnEventDoubleClicked (this);
                }
            }

            base.TouchesEnded (touches, evt);
        }
开发者ID:CartBlanche,项目名称:UICalendar,代码行数:26,代码来源:CalendarViews.cs

示例7: TouchesMoved

 public override void TouchesMoved(NSSet touches, UIEvent e)
 {
     base.TouchesMoved(touches, e);
     lock(TouchInputManager.lockObject)
         e.TouchesForView(this).Enumerate(eachTouchEnumerator);
 }
开发者ID:cryophobia,项目名称:exen,代码行数:6,代码来源:ExEnEmTouchGameView.cs

示例8: TouchesEnded

		public override void TouchesEnded (NSSet touches, UIEvent e)
		{
			var bounds = Bounds;
			var touch = (UITouch) e.TouchesForView (this).AnyObject;
			if (firstTouch) {
				firstTouch = false;
				PreviousLocation = touch.PreviousLocationInView (this);
				PreviousLocation.Y = bounds.Height - PreviousLocation.Y;
				RenderLineFromPoint (PreviousLocation, Location);
			}
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:11,代码来源:PaintingView.cs

示例9: TouchesBegan

		public override void TouchesBegan (NSSet touches, UIEvent e)
		{
			var bounds = Bounds;
			var touch = (UITouch) e.TouchesForView (this).AnyObject;
			firstTouch = true;
			Location = touch.LocationInView (this);
			Location.Y = bounds.Height - Location.Y;
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:8,代码来源:PaintingView.cs

示例10: TouchesEnded

		/// <summary>
		/// Dismiss the popover 
		/// </summary>
		public override void TouchesEnded (NSSet touches, UIEvent evt)
		{
			base.TouchesEnded (touches, evt);

			if (masterPopoverShown && evt.TouchesForView (masterView) == null)
			{
				HidePopover ();
			}
		}
开发者ID:EminosoftCorp,项目名称:prebuilt-apps,代码行数:12,代码来源:SplitController.cs

示例11: TouchesBegan

        public override void TouchesBegan(NSSet touches, UIEvent e)
        {
            base.TouchesBegan(touches, e);

            // TODO: move GraphicsDevice dependency somewhere sensible...
            var location = ((UITouch)(e.TouchesForView(this).AnyObject)).LocationInView(this);
            Point p = game.GraphicsDevice.Scaler.TouchToLogical(location);
            Mouse.currentState.X = p.X;
            Mouse.currentState.Y = p.Y;

            Mouse.currentState.LeftButton = ButtonState.Pressed;
        }
开发者ID:meds,项目名称:ChicksnVixens,代码行数:12,代码来源:ExEnEmTouchGameView.cs

示例12: TouchesBegan

        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            if (evt.TouchesForView(this).Count == 2 && linesInProcess.Count < 1) {
                bool firstTouch = true;
                Circle newCircle = new Circle();
                string key = "";
                foreach (UITouch t in touches) {
                    // Is this a double tap?
                    if (t.TapCount > 1) {
                        this.clearAll();
                        return;
                    }

                    // Create a circle for the value
                    CGPoint loc = t.LocationInView(this);

                    if (firstTouch) {
                        // Use the touch object (packed in an string, as the key)
                        key = NSValue.ValueFromNonretainedObject(t).ToString();
                        newCircle.center = loc;
                        firstTouch = false;
                    } else {
                        newCircle.point2 = loc;
                    }
                }
                newCircle.setColor();
                circlesInProcess.Add(key, newCircle);
            } else {
                foreach (UITouch t in touches) {
                    // Is this a double tap?
                    if (t.TapCount > 1) {
                        this.clearAll();
                        return;
                    }
                    // Use the touch object (packed in an string, as the key)
                    string key = NSValue.ValueFromNonretainedObject(t).ToString();

                    // Create a line for the value
                    CGPoint loc = t.LocationInView(this);
                    Line newLine = new Line();
                    newLine.begin = loc;
                    newLine.end = loc;

                    // Put pair in dictionary
                    newLine.setColor();
                    linesInProcess.Add(key, newLine);
                }
            }
            this.SetNeedsDisplay();
        }
开发者ID:yingfangdu,项目名称:BNR,代码行数:50,代码来源:TouchDrawView.cs

示例13: TouchesMoved

        public override void TouchesMoved(NSSet touches, UIEvent e)
        {
            base.TouchesMoved(touches, e);

            var location = ((UITouch)(e.TouchesForView(this).AnyObject)).LocationInView(this);
            Point p = game.GraphicsDevice.Scaler.TouchToLogical(location);
            Mouse.currentState.X = p.X;
            Mouse.currentState.Y = p.Y;
        }
开发者ID:meds,项目名称:ChicksnVixens,代码行数:9,代码来源:ExEnEmTouchGameView.cs

示例14: TouchesMoved

        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
            base.TouchesMoved (touches, evt);

            if (_dragView == null)
                return;

            var tfv = evt.TouchesForView(_dragView);
            if (tfv == null)
                return;

            var touch = (UITouch)tfv.AnyObject;
            var loc = this.Frame.Location;
            var size = this.Frame.Size;

            if (_dragView == _topLeft)
            {
                var xMovement = touch.LocationInView(_dragView).X - _location.X;
                if (loc.X + xMovement < 0)
                    xMovement = -loc.X;
                if (size.Width - xMovement < _dragView.Frame.Width * 2)
                    xMovement = size.Width - _dragView.Frame.Width * 2;

                loc.X += xMovement;
                size.Width += -(xMovement);

                var yMovement = touch.LocationInView(_dragView).Y - _location.Y;
                if (loc.Y + yMovement < 0)
                    yMovement = -loc.Y;
                if (size.Height - yMovement < _dragView.Frame.Height * 2)
                    yMovement = size.Height - _dragView.Frame.Height * 2;

                loc.Y += yMovement;
                size.Height += -(yMovement);
            }
            else if (_dragView == _bottomRight)
            {
                var xMovement = touch.LocationInView(_dragView).X - _location.X;
                if (size.Width + xMovement < _dragView.Frame.Width * 2)
                    xMovement = -size.Width + _dragView.Frame.Width * 2;
                if (loc.X + xMovement + size.Width > Superview.Bounds.Width)
                    xMovement = Superview.Bounds.Width - loc.X - size.Width;

                size.Width += xMovement;

                var yMovement = touch.LocationInView(_dragView).Y - _location.Y;
                if (size.Height + yMovement < _dragView.Frame.Height * 2)
                    yMovement = -size.Height + _dragView.Frame.Height * 2;
                if (loc.Y + yMovement + size.Height > Superview.Bounds.Height)
                    yMovement = Superview.Bounds.Height - loc.Y - size.Height;

                size.Height += yMovement;
            }
            else
            {
                var xMovement = touch.LocationInView(_dragView).X - _location.X;
                var yMovement = touch.LocationInView(_dragView).Y - _location.Y;

                if (loc.X + xMovement < 0)
                    xMovement = -loc.X;
                if (loc.Y + yMovement < 0)
                    yMovement = -loc.Y;
                if (loc.X + xMovement + size.Width > Superview.Bounds.Width)
                    xMovement = Superview.Bounds.Width - loc.X - size.Width;
                if (loc.Y + yMovement + size.Height > Superview.Bounds.Height)
                    yMovement = Superview.Bounds.Height - loc.Y - size.Height;

                loc.X += xMovement;
                loc.Y += yMovement;
            }

            this.Frame = new RectangleF(loc, size);
            this.SetNeedsDisplay();
        }
开发者ID:GSerjo,项目名称:appreciateui,代码行数:74,代码来源:CropView.cs

示例15: HandleTouches

        private void HandleTouches(Foundation.NSSet touches, UIEvent evt)
        {
            var touch = (UITouch)evt.TouchesForView (this).AnyObject;
            var pos = touch.LocationInView (this);

             float w = (float)Frame.Size.Width;
             float h = (float)Frame.Size.Height;

             float posX = (float)pos.X;
             float posY = (float)pos.Y;

             if (posX < 0)
                saturation = 0;
             else if (posX > w)
                saturation = 1;
            else
            saturation = posX / w;

             if (posY < 0)
                brightness = 1;
             else if (posY > h)
                brightness = 0;
            else
            brightness = 1 - (posY / h);

            if (ColorPicked != null) {
                ColorPicked ();
            }
        }
开发者ID:mubold,项目名称:AdvancedColorPicker,代码行数:29,代码来源:SaturationBrightnessPickerView.cs


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