本文整理汇总了C#中UISwipeGestureRecognizer.AddTarget方法的典型用法代码示例。如果您正苦于以下问题:C# UISwipeGestureRecognizer.AddTarget方法的具体用法?C# UISwipeGestureRecognizer.AddTarget怎么用?C# UISwipeGestureRecognizer.AddTarget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISwipeGestureRecognizer
的用法示例。
在下文中一共展示了UISwipeGestureRecognizer.AddTarget方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
View.BackgroundColor = UIColor.Clear;
Front = new FrontView (reviewableVerses[0]);
View.BackgroundColor = UIColor.FromPatternImage (UIImage.FromFile (Images.TableViewBackground));
Back = new BackView (reviewableVerses[position]);
MemorizedImage = UIImage.FromFile (Images.HeartRedButton);
NotMemorizedImage = UIImage.FromFile (Images.HeartGreyButton);
TapGesture = new UITapGestureRecognizer {
NumberOfTapsRequired = 1
};
TapGesture.AddTarget (FlipCardHandler);
SwipeUpGesture = new UISwipeGestureRecognizer {
Direction = UISwipeGestureRecognizerDirection.Up
};
SwipeUpGesture.AddTarget (NextCardHandler);
SwipeDownGesture = new UISwipeGestureRecognizer {
Direction = UISwipeGestureRecognizerDirection.Down,
};
SwipeDownGesture.AddTarget (NextCardHandler);
RightSwipeGesture = new UISwipeGestureRecognizer {
Direction = UISwipeGestureRecognizerDirection.Right
};
RightSwipeGesture.AddTarget (RightSwipeHandler);
HandleProductTourStep6 ();
View.Add (Front);
View.AddGestureRecognizer (SwipeUpGesture);
View.AddGestureRecognizer (SwipeDownGesture);
View.AddGestureRecognizer (RightSwipeGesture);
View.AddGestureRecognizer (TapGesture);
}
示例2: GestureFuch
private void GestureFuch()
{
UISwipeGestureRecognizer sgrRight = new UISwipeGestureRecognizer ();
UISwipeGestureRecognizer sgrLeft = new UISwipeGestureRecognizer ();
sgrRight.AddTarget (this, RightSwipeSelector);
sgrLeft.AddTarget (this, LeftSwipeSelector);
sgrRight.Direction = UISwipeGestureRecognizerDirection.Right;
sgrLeft.Direction = UISwipeGestureRecognizerDirection.Left;
sgrRight.Delegate = new SwipeRecogniserDelegate ();
sgrLeft.Delegate = new SwipeRecogniserDelegate ();
View.AddGestureRecognizer (sgrLeft);
View.AddGestureRecognizer (sgrRight);
}
示例3: 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
示例4: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
_gallery = new PhotoGallery();
image.ContentMode = UIViewContentMode.ScaleToFill;
setPhoto(_gallery.getCurrentPhoto());
// gestures (RIGHT)
UISwipeGestureRecognizer sgrRight=new UISwipeGestureRecognizer();
sgrRight.AddTarget(this,RightSwipeSelector);
sgrRight.Direction=UISwipeGestureRecognizerDirection.Right;
sgrRight.Delegate=new SwipeRecogniserDelegate();
View.AddGestureRecognizer(sgrRight);
// gestures (LEFT)
UISwipeGestureRecognizer sgrLeft=new UISwipeGestureRecognizer();
sgrLeft.AddTarget(this,LeftSwipeSelector);
sgrLeft.Direction=UISwipeGestureRecognizerDirection.Left;
sgrLeft.Delegate=new SwipeRecogniserDelegate();
View.AddGestureRecognizer(sgrLeft);
// Perform any additional setup after loading the view, typically from a nib.
}