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


C# UITouch类代码示例

本文整理汇总了C#中UITouch的典型用法代码示例。如果您正苦于以下问题:C# UITouch类的具体用法?C# UITouch怎么用?C# UITouch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ContinueTracking

        public override bool ContinueTracking(UITouch uitouch, UIEvent uievent)
        {
            if (!minThumbOn && !maxThumbOn)
                return true;

            var touchPoint = uitouch.LocationInView (this);
            if (minThumbOn)
            {
                minThumb.Center = new PointF(Math.Max (
                    XForValue(MinValue), Math.Min(touchPoint.X - distanceFromCenter, XForValue(SelectedMaxValue - MinRange))), minThumb.Center.Y - Frame.Top);
                SelectedMinValue = ValueForX (minThumb.Center.X);
            }

            if (maxThumbOn)
            {

                maxThumb.Center = new PointF(Math.Min (
                    XForValue(MaxValue),
                    Math.Max(
                        touchPoint.X - distanceFromCenter,
                        XForValue(SelectedMinValue + MinRange)
                      )
                    ), maxThumb.Center.Y - Frame.Top);

                SelectedMaxValue = ValueForX (maxThumb.Center.X);
            }

            UpdateTrackHighlight();
            this.SetNeedsLayout();

            if (ThumbChanged != null) ThumbChanged(this);

            return true;
        }
开发者ID:nicwise,项目名称:RangeSliderMonoTouch,代码行数:34,代码来源:RangeSlider.cs

示例2: AddSpot

		protected void AddSpot (UITouch touch)
		{
			// create a random color spot at the point of touch, then add it to the others
			Spot spot = Spot.CreateNewRandomColor (touch.LocationInView (this));
			touchSpots.Add (spot);
			// tell the OS to redraw
			SetNeedsDisplay ();
		}
开发者ID:BoogieMAN2K,项目名称:monotouch-samples,代码行数:8,代码来源:View.cs

示例3: EndTracking

        public override void EndTracking(UITouch uitouch, UIEvent uievent)
        {
            _leftKnobLayer.Highlighted = false;
            _rightKnobLayer.Highlighted = false;

            _leftKnobLayer.SetNeedsDisplay ();
            _rightKnobLayer.SetNeedsDisplay ();
        }
开发者ID:jasallen,项目名称:RangeSliderDemoVideoFiles,代码行数:8,代码来源:RangeSliderView.cs

示例4: BeginTracking

        public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
        {
            if (uievent.Type == UIEventType.Touches)
            {
                SetNeedsDisplay();
            }

            return base.BeginTracking(uitouch, uievent);
        }
开发者ID:Clancey,项目名称:ClanceyLib,代码行数:9,代码来源:UIHorizontalButton.cs

示例5: ContinueTracking

		public override bool ContinueTracking (UITouch uitouch, UIEvent uievent)
		{
			var touch = uievent.AllTouches.AnyObject as UITouch;
			if (Bounds.Contains (touch.LocationInView (this)))
				isPressed = true;
			else
				isPressed = false;
			return base.ContinueTracking (uitouch, uievent);
		}
开发者ID:King-of-Spades,项目名称:xamarin-samples,代码行数:9,代码来源:GlossyButton.cs

示例6: EndTracking

		public override void EndTracking (UITouch uitouch, UIEvent uievent)
		{
			if (isPressed && Enabled){
				if (Tapped != null)
					Tapped (this);
			}
			isPressed = false;
			SetNeedsDisplay ();
			base.EndTracking (uitouch, uievent);
		}
开发者ID:King-of-Spades,项目名称:xamarin-samples,代码行数:10,代码来源:GlossyButton.cs

示例7: EndTracking

 public override void EndTracking(UITouch uitouch, UIEvent uievent)
 {
     if (pressed && Enabled)
     {
         Tapped?.Invoke(this);
     }
     pressed = false;
     SetNeedsDisplay();
     base.EndTracking(uitouch, uievent);
 }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:10,代码来源:GlassButton.cs

示例8: UpdateWithTouch

		public bool UpdateWithTouch (UITouch touch)
		{
			NSNumber estimationUpdateIndex = touch.EstimationUpdateIndex;

			if (estimationUpdateIndex != EstimationUpdateIndex)
				return false;

			// An array of the touch properties that may be of interest.
			UITouchProperties[] touchProperties = {
				UITouchProperties.Location,
				UITouchProperties.Force,
				UITouchProperties.Altitude,
				UITouchProperties.Azimuth
			};

			// Iterate through possible properties.
			foreach (var expectedProperty in touchProperties) {
				// If an update to this property is not expected, continue to the next property.
				if (EstimatedPropertiesExpectingUpdates.Has (expectedProperty))
					continue;

				switch (expectedProperty) {
				case UITouchProperties.Force:
					Force = touch.Force;
					break;
				case UITouchProperties.Azimuth:
					AzimuthAngle = touch.GetAzimuthAngle (touch.View);
					break;
				case UITouchProperties.Altitude:
					AltitudeAngle = touch.AltitudeAngle;
					break;
				case UITouchProperties.Location:
					Location = touch.LocationInView (touch.View);
					PreciseLocation = touch.PreviousLocationInView (touch.View);
					break;
				}

				if (!touch.EstimatedProperties.Has (expectedProperty)) {
					// Flag that this point now has a 'final' value for this property.
					EstimatedProperties = EstimatedProperties.Remove (expectedProperty);
				}

				if (!touch.EstimatedPropertiesExpectingUpdates.Has (expectedProperty)) {
					// Flag that this point is no longer expecting updates for this property.
					EstimatedPropertiesExpectingUpdates = EstimatedPropertiesExpectingUpdates.Remove (expectedProperty);

					if (EstimatedPropertiesExpectingUpdates == 0) {
						PointType = this.PointType.Remove (PointType.NeedsUpdate);
						PointType = this.PointType.Add (PointType.Updated);
					}
				}
			}

			return true;
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:55,代码来源:LinePoint.cs

示例9: AddPointOfType

        public CGRect AddPointOfType(PointType pointType, UITouch touch)
        {
            var previousPoint = Points.LastOrDefault ();
            var previousSequenceNumber = previousPoint != null ? previousPoint.SequenceNumber : -1;
            var point = new LinePoint (touch, previousSequenceNumber + 1, pointType);

            if (point.EstimationUpdateIndex != null && point.EstimatedPropertiesExpectingUpdates != 0)
                pointsWaitingForUpdatesByEstimationIndex [point.EstimationUpdateIndex] = point;

            Points.Add (point);
            return UpdateRectForLinePoint (point, previousPoint);
        }
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:12,代码来源:Line.cs

示例10: BeginTracking

        public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
        {
            var touchPoint = uitouch.LocationInView (this);

            if (minThumb.Frame.Contains (touchPoint)) {
                minThumbOn = true;
                distanceFromCenter = touchPoint.X - minThumb.Center.X;
            } else if (maxThumb.Frame.Contains (touchPoint)) {
                maxThumbOn = true;
                distanceFromCenter = touchPoint.X - maxThumb.Center.X;
            }

            return true;
        }
开发者ID:nicwise,项目名称:RangeSliderMonoTouch,代码行数:14,代码来源:RangeSlider.cs

示例11: BeginTracking

        public override bool BeginTracking(UITouch uitouch, UIEvent uievent)
        {
            var TouchPoint = uitouch.LocationInView (this);

            if (_leftKnobLayer.Frame.Contains (TouchPoint)) {
                _leftTouchPoint = TouchPoint;
                _leftKnobLayer.Highlighted = true;
                _leftKnobLayer.SetNeedsDisplay ();
            }
            else if (_rightKnobLayer.Frame.Contains (TouchPoint)) {
                _rightTouchPoint = TouchPoint;
                _rightKnobLayer.Highlighted = true;
                _rightKnobLayer.SetNeedsDisplay ();
            }

            return _leftKnobLayer.Highlighted || _rightKnobLayer.Highlighted;
        }
开发者ID:jasallen,项目名称:RangeSliderDemoVideoFiles,代码行数:17,代码来源:RangeSliderView.cs

示例12: GetState

        private PointerState GetState(UITouch touch)
        {
            switch (touch.Phase)
            {
                case UITouchPhase.Began:
                    return PointerState.Down;
                case UITouchPhase.Moved:
                case UITouchPhase.Stationary:
                    return PointerState.Move;
                case UITouchPhase.Ended:
                    return PointerState.Up;
                case UITouchPhase.Cancelled:
                    return PointerState.Cancel;
            }

            throw new ArgumentException("Got an invalid Touch event in GetState");
        }
开发者ID:ItayGal2,项目名称:paradox,代码行数:17,代码来源:InputManager.iOS.cs

示例13: ContinueTracking

        public override bool ContinueTracking(UITouch uitouch, UIEvent uievent)
        {
            var TouchPoint = uitouch.LocationInView (this);

            if (_leftKnobLayer.Highlighted) {
                _leftTouchPoint = TouchPoint;
            } else if (_rightKnobLayer.Highlighted) {
                _rightTouchPoint = TouchPoint;
            }

            CATransaction.Begin ();
            CATransaction.DisableActions = true;

            SetLayerFrames ();

            CATransaction.Commit ();

            return _leftKnobLayer.Highlighted || _rightKnobLayer.Highlighted;
        }
开发者ID:jasallen,项目名称:RangeSliderDemoVideoFiles,代码行数:19,代码来源:RangeSliderView.cs

示例14: LinePoint

		public LinePoint (UITouch touch, int sequenceNumber, PointType pointType)
		{
			SequenceNumber = sequenceNumber;
			Type = touch.Type;
			PointType = pointType;

			Timestamp = touch.Timestamp;
			var view = touch.View;
			Location = touch.LocationInView (view);
			PreciseLocation = touch.GetPreciseLocation (view);
			AzimuthAngle = touch.GetAzimuthAngle (view);
			EstimatedProperties = touch.EstimatedProperties;
			EstimatedPropertiesExpectingUpdates = touch.EstimatedPropertiesExpectingUpdates;
			AltitudeAngle = touch.AltitudeAngle;
			Force = (Type == UITouchType.Stylus || touch.Force > 0) ? touch.Force : 1f;

			if (EstimatedPropertiesExpectingUpdates != 0)
				PointType = this.PointType.Add (PointType.NeedsUpdate);

			EstimationUpdateIndex = touch.EstimationUpdateIndex;
		}
开发者ID:93asad,项目名称:monotouch-samples,代码行数:21,代码来源:LinePoint.cs

示例15: UpdateReticleView

		void UpdateReticleView (UITouch touch, bool predicated = false)
		{
			if (touch == null)
				return;

			ReticleView.PredictedDotLayer.Hidden = !predicated;
			ReticleView.PredictedLineLayer.Hidden = !predicated;

			ReticleView.Center = touch.LocationInView (touch.View);

			var azimuthAngle = touch.GetAzimuthAngle (touch.View);
			var azimuthUnitVector = touch.GetAzimuthUnitVector (touch.View);
			var altitudeAngle = touch.AltitudeAngle;

			if (predicated) {
				ReticleView.PredictedAzimuthAngle = azimuthAngle;
				ReticleView.PredictedAzimuthUnitVector = azimuthUnitVector;
				ReticleView.PredictedAzimuthAngle = altitudeAngle;
			} else {
				ReticleView.ActualAzimuthAngle = azimuthAngle;
				ReticleView.ActualAzimuthUnitVector = azimuthUnitVector;
				ReticleView.ActualAzimuthAngle = altitudeAngle;
			}
		}
开发者ID:russellharvey,项目名称:monotouch-samples,代码行数:24,代码来源:MainViewController.cs


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