本文整理汇总了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);
}
示例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);
}
示例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 ();
}
示例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);
}
示例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();
}
示例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);
}
示例7: TouchesMoved
public override void TouchesMoved(NSSet touches, UIEvent e)
{
base.TouchesMoved(touches, e);
lock(TouchInputManager.lockObject)
e.TouchesForView(this).Enumerate(eachTouchEnumerator);
}
示例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);
}
}
示例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;
}
示例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 ();
}
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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 ();
}
}