本文整理汇总了C#中UISwipeGestureRecognizer类的典型用法代码示例。如果您正苦于以下问题:C# UISwipeGestureRecognizer类的具体用法?C# UISwipeGestureRecognizer怎么用?C# UISwipeGestureRecognizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UISwipeGestureRecognizer类属于命名空间,在下文中一共展示了UISwipeGestureRecognizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TouchDrawView
public TouchDrawView(CGRect rect)
: base(rect)
{
linesInProcess = new Dictionary<string, Line>();
this.BackgroundColor = UIColor.White;
this.MultipleTouchEnabled = true;
UITapGestureRecognizer tapRecognizer = new UITapGestureRecognizer(tap);
this.AddGestureRecognizer(tapRecognizer);
UITapGestureRecognizer dbltapRecognizer = new UITapGestureRecognizer(dblTap);
dbltapRecognizer.NumberOfTapsRequired = 2;
this.AddGestureRecognizer(dbltapRecognizer);
UILongPressGestureRecognizer pressRecognizer = new UILongPressGestureRecognizer(longPress);
this.AddGestureRecognizer(pressRecognizer);
moveRecognizer = new UIPanGestureRecognizer(moveLine);
moveRecognizer.WeakDelegate = this;
moveRecognizer.CancelsTouchesInView = false;
this.AddGestureRecognizer(moveRecognizer);
UISwipeGestureRecognizer swipeRecognizer = new UISwipeGestureRecognizer(swipe);
swipeRecognizer.Direction = UISwipeGestureRecognizerDirection.Up;
swipeRecognizer.NumberOfTouchesRequired = 3;
this.AddGestureRecognizer(swipeRecognizer);
selectedColor = UIColor.Red;
}
开发者ID:yingfangdu,项目名称:BNR,代码行数:29,代码来源:TouchDrawView.cs
示例2: ViewDidLoad
public override void ViewDidLoad()
{
View.BackgroundColor = UIColor.White;
_imageView = new UIImageView(View.Frame)
{
MultipleTouchEnabled = true,
UserInteractionEnabled = true,
ContentMode = UIViewContentMode.ScaleAspectFit,
AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight
};
var tapGesture = new UITapGestureRecognizer(OnImageTap);
_imageView.AddGestureRecognizer(tapGesture);
var leftSwipe = new UISwipeGestureRecognizer(OnImageSwipe)
{
Direction = UISwipeGestureRecognizerDirection.Left
};
_imageView.AddGestureRecognizer(leftSwipe);
var rigthSwipe = new UISwipeGestureRecognizer(OnImageSwipe)
{
Direction = UISwipeGestureRecognizerDirection.Right
};
_imageView.AddGestureRecognizer(rigthSwipe);
View.AddSubview(_imageView);
PHAsset asset = _imageCache.GetAsset(_image.LocalIdentifier);
UpdateImage(asset);
}
开发者ID:GSerjo,项目名称:ImagePocket,代码行数:31,代码来源:PhotoViewController.cs
示例3: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
MainBackButtonTmp.BackButtonClick = true;
_tabController = this;
_localizer = new Localizer ();
CustomUIViewController tabVAC, tabILL, tabOVT, tabPOV, tabEXV;
tabVAC = CreateTabViewController ("VAC", 0);
tabILL = CreateTabViewController ("ILL", 1);
tabOVT = CreateTabViewController ("OVT", 2);
tabPOV = CreateTabViewController ("POV", 3);
tabEXV = CreateTabViewController ("EXV", 4);
var tabs = new CustomUIViewController[] {
tabVAC, tabILL, tabOVT, tabPOV, tabEXV
};
ViewControllers = tabs;
SelectedViewController = tabVAC;
_swipeRecognizerRight = new UISwipeGestureRecognizer (OnSwipeRight){
Direction = UISwipeGestureRecognizerDirection.Right
};
_swipeRecognizerLeft = new UISwipeGestureRecognizer (OnSwipeLeft){
Direction = UISwipeGestureRecognizerDirection.Left
};
View.AddGestureRecognizer (_swipeRecognizerRight);
View.AddGestureRecognizer (_swipeRecognizerLeft);
}
开发者ID:dtimyr,项目名称:xamarin,代码行数:35,代码来源:CreateViewController.cs
示例4: OnElementChanged
/// <summary>
/// Called when [element changed].
/// </summary>
/// <param name="e">The e.</param>
protected override void OnElementChanged (ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged (e);
var view = (ExtendedEditor)Element;
if (view != null)
{
Control.Font = view.Font.ToUIFont();
}
if (e.OldElement == null)
{
_leftSwipeGestureRecognizer = new UISwipeGestureRecognizer(() => view.OnLeftSwipe(this, EventArgs.Empty))
{
Direction = UISwipeGestureRecognizerDirection.Left
};
_rightSwipeGestureRecognizer = new UISwipeGestureRecognizer(()=> view.OnRightSwipe(this, EventArgs.Empty))
{
Direction = UISwipeGestureRecognizerDirection.Right
};
Control.AddGestureRecognizer(_leftSwipeGestureRecognizer);
Control.AddGestureRecognizer(_rightSwipeGestureRecognizer);
}
if (e.NewElement == null)
{
Control.RemoveGestureRecognizer(_leftSwipeGestureRecognizer);
Control.RemoveGestureRecognizer(_rightSwipeGestureRecognizer);
}
}
开发者ID:HugeLawn-MiracleApps,项目名称:Xamarin-Forms-Labs,代码行数:36,代码来源:ExtendedEditorRenderer.cs
示例5: OnElementChanged
protected override void OnElementChanged (VisualElementChangedEventArgs e)
{
base.OnElementChanged (e);
if (e.NewElement != null) {
tabbedController = (UITabBarController)ViewController;
}
if (!isInitialized) {
rightGesture = new UISwipeGestureRecognizer (swipe => {
//Check to make sure we aren't at the last view
Console.WriteLine ("Swipe Left");
if(this.SelectedIndex != ViewControllers.Length - 1)
tabbedController.SelectedViewController = ViewControllers [this.SelectedIndex + 1];
}) {
Direction = UISwipeGestureRecognizerDirection.Left
};
leftGesture = new UISwipeGestureRecognizer (swipe => {
//Check to make sure we aren't at the first view
Console.WriteLine ("Swipe Right");
if(this.SelectedIndex != 0)
tabbedController.SelectedViewController = ViewControllers [this.SelectedIndex - 1];
}) {
Direction = UISwipeGestureRecognizerDirection.Right
};
View.AddGestureRecognizer (rightGesture);
View.AddGestureRecognizer (leftGesture);
isInitialized = true;
}
}
开发者ID:ChandrakanthBCK,项目名称:customer-success-samples,代码行数:34,代码来源:TabbedPageCustomRenderer.cs
示例6: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
var table = new UITableView (new CoreGraphics.CGRect (0f, 20f, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height)); // defaults to Plain style
quotes.Add(new Quote("列表", "向右慢拉返回", ""));
quotes.Add(new Quote("", "Loading...", ""));
table.Source = new QuoteTableSource (quotes);
UISwipeGestureRecognizer swipeGestureRecognizerRight = new UISwipeGestureRecognizer (() => {
DismissViewController(true, null);
}){
Direction = UISwipeGestureRecognizerDirection.Right
};
this.View.AddGestureRecognizer (swipeGestureRecognizerRight);
Thread thread = new Thread(() => {
update(location, model);
InvokeOnMainThread(delegate {
table.ReloadData();
});
});
thread.Start ();
Add (table);
}
开发者ID:JrRjChan,项目名称:FireWindforiOS,代码行数:25,代码来源:QuoteTableViewController.cs
示例7: Easter
public Easter(UIView viewForGestures, params Egg[] eggs)
: base(eggs)
{
swipeUp = new UISwipeGestureRecognizer (() => AddCommand (new SwipeUpCommand()));
swipeUp.Direction = UISwipeGestureRecognizerDirection.Up;
viewForGestures.AddGestureRecognizer (swipeUp);
swipeDown = new UISwipeGestureRecognizer (() => AddCommand (new SwipeDownCommand()));
swipeDown.Direction = UISwipeGestureRecognizerDirection.Down;
viewForGestures.AddGestureRecognizer (swipeDown);
swipeLeft = new UISwipeGestureRecognizer (() => AddCommand (new SwipeLeftCommand()));
swipeLeft.Direction = UISwipeGestureRecognizerDirection.Left;
viewForGestures.AddGestureRecognizer (swipeLeft);
swipeRight = new UISwipeGestureRecognizer (() => AddCommand (new SwipeRightCommand()));
swipeRight.Direction = UISwipeGestureRecognizerDirection.Right;
viewForGestures.AddGestureRecognizer (swipeRight);
tap = new UITapGestureRecognizer (() => AddCommand (new TapCommand()));
tap.NumberOfTapsRequired = 1;
viewForGestures.AddGestureRecognizer (tap);
longTap = new UILongPressGestureRecognizer (() => AddCommand (new LongTapCommand()));
longTap.NumberOfTapsRequired = 1;
viewForGestures.AddGestureRecognizer (longTap);
}
开发者ID:Redth,项目名称:EggsToGo,代码行数:27,代码来源:Easter.cs
示例8: OnElementChanged
protected override void OnElementChanged (ElementChangedEventArgs<View> e)
{
base.OnElementChanged (e);
//If the NewElement has been queued up
if (e.NewElement != null) {
//Set SliderView Instance
_sliderView = e.NewElement as SliderView;
//Make the currentView the same dimensions of the SliderView
_sliderView.Children [currentViewIndex].HeightRequest = _sliderView.Height;
_sliderView.Children [currentViewIndex].WidthRequest = _sliderView.Width;
//This is an optional thing, really depends on how you want to use this SliderView
_sliderView.Children [currentViewIndex].BackgroundColor = _sliderView.BackgroundColor;
}
//Create the gesture that brings the view in from the right side
rightGesture = new UISwipeGestureRecognizer (swipe => {
Console.WriteLine("Swipe Left");
//Check to make sure we aren't on the current view
if (_sliderView.Children.Count > currentViewIndex + 1 ) {
//Add one to the index
currentViewIndex++;
_sliderView.CurrentView = _sliderView.Children [currentViewIndex];
_sliderView.CurrentView.HeightRequest = _sliderView.Height;
_sliderView.CurrentView.WidthRequest = _sliderView.Width;
_sliderView.CurrentView.BackgroundColor = _sliderView.BackgroundColor;
//Translate the CurrentView onto the ViewScreen
TranslateToCurrentView ("Left");
}
}) {
Direction = UISwipeGestureRecognizerDirection.Left
};
//Create the gesture that brings the view in from the left side
leftGesture = new UISwipeGestureRecognizer (swipe => {
//Check to make sure we aren't at the first view
if (currentViewIndex != 0) {
//Drop the index one
currentViewIndex--;
//Set the new CurrentView
_sliderView.CurrentView = _sliderView.Children [currentViewIndex];
//Set the size of the CurrentView to the size of the SliderView
_sliderView.CurrentView.HeightRequest = _sliderView.Height;
_sliderView.CurrentView.WidthRequest = _sliderView.Width;
//This is an optional thing, really depends on how you want to use this SliderView
_sliderView.CurrentView.BackgroundColor = _sliderView.BackgroundColor;
//Translate the CurrentView onto the ViewScreen
TranslateToCurrentView ("Right");
}
}) {
Direction = UISwipeGestureRecognizerDirection.Right
};
//Add the Gesture Recognizers to the SliderView
AddGestureRecognizer (rightGesture);
AddGestureRecognizer (leftGesture);
}
开发者ID:biyyalakamal,项目名称:customer-success-samples,代码行数:60,代码来源:SliderCarouselViewRenderer.cs
示例9: HandleRightSwipe
public void HandleRightSwipe(UISwipeGestureRecognizer recogniser)
{
Debug.WriteLine("Got a right swipe.");
SetRandomCurrent ();
RenderCurrent ();
}
开发者ID:nakedslavin,项目名称:Autoskola,代码行数:8,代码来源:RidicakViewController.cs
示例10: FinishedLaunching
// This method is invoked when the application has loaded and is ready to run. In this
// method you should instantiate the window, load the UI into it and then make the window
// visible.
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
window = new UIWindow (UIScreen.MainScreen.Bounds);
// create and initialize a UICollectionViewFlowLayout
layout = new UICollectionViewFlowLayout () {
HeaderReferenceSize = new SizeF (UIScreen.MainScreen.Bounds.Width, 50),
SectionInset = new UIEdgeInsets (10,5,10,5),
MinimumInteritemSpacing = 5,
MinimumLineSpacing = 5,
ItemSize = new System.Drawing.SizeF (100, 100)
};
// create a CollectionViewController (which is a UICollectionViewController) with a layout
viewController = new CollectionViewController (layout);
//TODO: Step 4b: uncomment to implement a left swipe gesture to switch between Collection View Layouts
// toggle the layout in response to a swipe left
swipeLeft = new UISwipeGestureRecognizer (g => {
if (customLayout == null) {
// create and initialize a CustomLayout
customLayout = new CustomLayout (viewController.Speakers.Count){
ItemSize = new SizeF (100, 100)
};
}
if (viewController.CollectionView.CollectionViewLayout is UICollectionViewFlowLayout) {
// switch to a custom layout
viewController.CollectionView.SetCollectionViewLayout (customLayout, true);
} else {
// invalidate the flow layout in case the orientation changed
layout.InvalidateLayout();
// switch to a flow layout
viewController.CollectionView.SetCollectionViewLayout (layout, true);
// scroll to the top
viewController.CollectionView.SetContentOffset(new PointF(0,0), false);
}
}){
Direction = UISwipeGestureRecognizerDirection.Left
};
// add the gesture recognizer to the UICollectionView
viewController.CollectionView.AddGestureRecognizer (swipeLeft);
window.RootViewController = viewController;
window.MakeKeyAndVisible ();
return true;
}
开发者ID:CodeMangler,项目名称:XamarinUniversity,代码行数:61,代码来源:AppDelegate.cs
示例11: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
{
base.OnElementChanged (e);
if (e.NewElement == null) {
RemoveGestureRecognizer ();
return;
}
var gestureView = e.NewElement as GestureAwareContentView;
_longPressGestureRecognizer = new UILongPressGestureRecognizer (
sender => {
var offset = sender.LocationInView(NativeView);
GestureUtil.ExecuteCommand(gestureView.LongPress,
new GestureOffset(sender.State.ToGestureState(), offset.X, offset.Y));
});
_pinchGestureRecognizer = new UIPinchGestureRecognizer (
sender => {
var scale = sender.Scale;
GestureUtil.ExecuteCommand(gestureView.Pinch,
new GestureScale(sender.State.ToGestureState(), scale));
});
_panGestureRecognizer = new UIPanGestureRecognizer (
sender => {
var offset = sender.TranslationInView(NativeView);
GestureUtil.ExecuteCommand(gestureView.Pan,
new GestureOffset(sender.State.ToGestureState(), offset.X, offset.Y));
});
_swipeGestureRecognizer = new UISwipeGestureRecognizer (
sender => {
var offset = sender.LocationInView(NativeView);
GestureUtil.ExecuteCommand(gestureView.Swipe,
new GestureOffset(sender.State.ToGestureState(), offset.X, offset.Y));
});
_rotationGestureRecognizer = new UIRotationGestureRecognizer (
sender => {
GestureUtil.ExecuteCommand (gestureView.Rotate);
});
AddGestureRecognizer (_longPressGestureRecognizer);
AddGestureRecognizer (_pinchGestureRecognizer);
AddGestureRecognizer (_panGestureRecognizer);
AddGestureRecognizer (_swipeGestureRecognizer);
AddGestureRecognizer (_rotationGestureRecognizer);
}
开发者ID:pragmaticlogic,项目名称:athena,代码行数:55,代码来源:GestureAwareContentViewRenderer.cs
示例12: addGesture
/// <summary>
/// Adds the gesture.
/// </summary>
private void addGesture()
{
UISwipeGestureRecognizer swipe = new UISwipeGestureRecognizer (this, new Selector ("HandleSwipe:")) {
Direction = UISwipeGestureRecognizerDirection.Up
};
DetailTextView.AddGestureRecognizer (swipe);
swipe = new UISwipeGestureRecognizer (this, new Selector ("HandleSwipe:")) {
Direction = UISwipeGestureRecognizerDirection.Down
};
DetailTextView.AddGestureRecognizer (swipe);
}
开发者ID:eternaltung,项目名称:RottenTomatoes-Xamarin.iOS,代码行数:14,代码来源:DetailViewController.cs
示例13: 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);
}
开发者ID:pierceboggan,项目名称:Verses,代码行数:42,代码来源:FlipCardController.cs
示例14: FnInitializeView
void FnInitializeView()
{
CGRect rectBounds= UIScreen.MainScreen.Bounds;
flViewBringDownY = rectBounds.Height - 30f; //complete collapse viewContainer
flViewShiftUpY = rectBounds.Height - 120f;//200 is the heght of viewContainer
var recognizerRight = new UISwipeGestureRecognizer (FnSwipeLeftToRight);
recognizerRight.Direction = UISwipeGestureRecognizerDirection.Right;
View.AddGestureRecognizer ( recognizerRight );
var recognizerLeft = new UISwipeGestureRecognizer (FnSwipeRightToLeft);
recognizerLeft.Direction = UISwipeGestureRecognizerDirection.Left;
View.AddGestureRecognizer ( recognizerLeft );
viewDecriptionContainer.Hidden = true;
btnIcon.SetBackgroundImage ( UIImage.FromBundle ( "Images/menu_icon" ) , UIControlState.Normal );
// btnBottom.SetBackgroundImage ( UIImage.FromBundle ( "Images/up_arrow" ) , UIControlState.Normal );
btnBottom.SetBackgroundImage ( UIImage.FromBundle ( "Images/down_arrow" ) , UIControlState.Selected );
btnBottom.TouchUpInside+= delegate(object sender , EventArgs e )
{
if(viewDecriptionContainer.Hidden)
viewDecriptionContainer.Hidden=false;
if(!btnBottom.Selected)
FnAnimateView(flViewShiftUpY,viewDecriptionContainer);
else
FnAnimateView(flViewBringDownY,viewDecriptionContainer);
btnBottom.Selected = !btnBottom.Selected;
};
btnIcon.TouchUpInside += delegate(object sender , EventArgs e )
{
FnPerformTableTransition();
};
}
开发者ID:suchithm,项目名称:SlidingMenu_Xamarin.iOS,代码行数:41,代码来源:ViewController.cs
示例15: OnElementChanged
/// <summary>
/// Handles the <see cref="E:ElementChanged" /> event.
/// </summary>
/// <param name="e">The <see cref="VisualElementChangedEventArgs"/> instance containing the event data.</param>
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
base.OnElementChanged(e);
var page = (ExtendedTabbedPage)Element;
TabBar.TintColor = page.TintColor.ToUIColor();
TabBar.BarTintColor = page.BarTintColor.ToUIColor();
TabBar.BackgroundColor = page.BackgroundColor.ToUIColor();
if (!page.SwipeEnabled)
{
return;
}
var gesture1 = new UISwipeGestureRecognizer(sw =>
{
sw.ShouldReceiveTouch += (recognizer, touch) => !(touch.View is UITableView) && !(touch.View is UITableViewCell);
if (sw.Direction == UISwipeGestureRecognizerDirection.Right)
{
page.InvokeSwipeLeftEvent(null, null);
}
}) { Direction = UISwipeGestureRecognizerDirection.Right };
var gesture2 = new UISwipeGestureRecognizer(sw =>
{
sw.ShouldReceiveTouch += (recognizer, touch) => !(touch.View is UITableView) && !(touch.View is UITableViewCell);
if (sw.Direction == UISwipeGestureRecognizerDirection.Left)
{
page.InvokeSwipeRightEvent(null, null);
}
}) { Direction = UISwipeGestureRecognizerDirection.Left };
View.AddGestureRecognizer(gesture1);
View.AddGestureRecognizer(gesture2);
}
开发者ID:Jaskomal,项目名称:Xamarin-Forms-Labs,代码行数:45,代码来源:ExtendedTabbedPageRenderer.cs
示例16: OnElementChanged
/// <summary>
/// The on element changed callback.
/// </summary>
/// <param name="e">The event arguments.</param>
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
var view = e.NewElement as ExtendedEntry;
if (view != null)
{
SetFont (view);
SetTextAlignment (view);
SetBorder (view);
SetPlaceholderTextColor (view);
SetMaxLength (view);
ResizeHeight ();
}
if (e.OldElement == null)
{
_leftSwipeGestureRecognizer = new UISwipeGestureRecognizer(() => view.OnLeftSwipe(this, EventArgs.Empty))
{
Direction = UISwipeGestureRecognizerDirection.Left
};
_rightSwipeGestureRecognizer = new UISwipeGestureRecognizer(()=> view.OnRightSwipe(this, EventArgs.Empty))
{
Direction = UISwipeGestureRecognizerDirection.Right
};
Control.AddGestureRecognizer(_leftSwipeGestureRecognizer);
Control.AddGestureRecognizer(_rightSwipeGestureRecognizer);
}
if (e.NewElement == null)
{
Control.RemoveGestureRecognizer(_leftSwipeGestureRecognizer);
Control.RemoveGestureRecognizer(_rightSwipeGestureRecognizer);
}
}
开发者ID:HugeLawn-MiracleApps,项目名称:Xamarin-Forms-Labs,代码行数:43,代码来源:ExtendedEntryRenderer.cs
示例17: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
{
base.OnElementChanged (e);
if (e.NewElement is MyImage) {
image = e.NewElement as MyImage;
UIView view = this as UIView;
view.UserInteractionEnabled = true;
UISwipeGestureRecognizer gestureRecognizerLeft = new UISwipeGestureRecognizer (() => {
image.SwipedLeft();
});
gestureRecognizerLeft.Direction = UISwipeGestureRecognizerDirection.Left;
UISwipeGestureRecognizer gestureRecognizerRight = new UISwipeGestureRecognizer (() => {
image.SwipedRight();
});
gestureRecognizerRight.Direction = UISwipeGestureRecognizerDirection.Right;
view.AddGestureRecognizer (gestureRecognizerLeft);
view.AddGestureRecognizer (gestureRecognizerRight);
}
}
开发者ID:rughvi,项目名称:imageswipe,代码行数:23,代码来源:MyImageRenderer.cs
示例18: OnElementChanged
protected override void OnElementChanged (ElementChangedEventArgs<Label> e)
{
base.OnElementChanged (e);
longPressGestureRecognizer = new UILongPressGestureRecognizer (() => Console.WriteLine ("Long Press"));
pinchGestureRecognizer = new UIPinchGestureRecognizer (() => Console.WriteLine ("Pinch"));
panGestureRecognizer = new UIPanGestureRecognizer (() => Console.WriteLine ("Pan"));
swipeGestureRecognizer = new UISwipeGestureRecognizer (() => Console.WriteLine ("Swipe"));
rotationGestureRecognizer = new UIRotationGestureRecognizer (() => Console.WriteLine ("Rotation"));
if (e.NewElement == null) {
if (longPressGestureRecognizer != null) {
this.RemoveGestureRecognizer (longPressGestureRecognizer);
}
if (pinchGestureRecognizer != null) {
this.RemoveGestureRecognizer (pinchGestureRecognizer);
}
if (panGestureRecognizer != null) {
this.RemoveGestureRecognizer (panGestureRecognizer);
}
if (swipeGestureRecognizer != null) {
this.RemoveGestureRecognizer (swipeGestureRecognizer);
}
if (rotationGestureRecognizer != null) {
this.RemoveGestureRecognizer (rotationGestureRecognizer);
}
}
if (e.OldElement == null) {
this.AddGestureRecognizer (longPressGestureRecognizer);
this.AddGestureRecognizer (pinchGestureRecognizer);
this.AddGestureRecognizer (panGestureRecognizer);
this.AddGestureRecognizer (swipeGestureRecognizer);
this.AddGestureRecognizer (rotationGestureRecognizer);
}
}
开发者ID:RobGibbens,项目名称:XamarinFormsGestureRecognizers,代码行数:36,代码来源:FancyIosLabelRenderer.cs
示例19: setupSwipeControls
private void setupSwipeControls()
{
UISwipeGestureRecognizer upswipe = new UISwipeGestureRecognizer (this, new Selector ("up:"));
upswipe.NumberOfTouches = 1;
upswipe.Direction = UISwipeGestureRecognizerDirection.Up;
View.AddGestureRecognizer (upswipe);
UISwipeGestureRecognizer downswipe = new UISwipeGestureRecognizer (this, new Selector ("down:"));
downswipe.NumberOfTouches = 1;
downswipe.Direction = UISwipeGestureRecognizerDirection.Down;
View.AddGestureRecognizer (downswipe);
UISwipeGestureRecognizer leftswipe = new UISwipeGestureRecognizer (this, new Selector ("left:"));
leftswipe.NumberOfTouches = 1;
leftswipe.Direction = UISwipeGestureRecognizerDirection.Left;
View.AddGestureRecognizer (leftswipe);
UISwipeGestureRecognizer rightswipe = new UISwipeGestureRecognizer (this, new Selector ("right:"));
rightswipe.NumberOfTouches = 1;
rightswipe.Direction = UISwipeGestureRecognizerDirection.Left;
View.AddGestureRecognizer (rightswipe);
}
开发者ID:fadingflower,项目名称:Xamarin-2048,代码行数:24,代码来源:NumberTileGameViewController.cs
示例20: CalendarMonthView
public CalendarMonthView(DateTime selectedDate, bool showHeader, float width = 320)
{
_showHeader = showHeader;
if (_showHeader)
headerHeight = 20;
if (_showHeader)
this.Frame = new RectangleF(0, 0, width, 218);
else
this.Frame = new RectangleF(0, 0, width, 198);
BoxWidth = Convert.ToInt32(Math.Ceiling( width / 7 ));
BackgroundColor = UIColor.White;
ClipsToBounds = true;
CurrentSelectedDate = selectedDate;
CurrentDate = DateTime.Now.Date;
CurrentMonthYear = new DateTime(CurrentSelectedDate.Year, CurrentSelectedDate.Month, 1);
var swipeLeft = new UISwipeGestureRecognizer(p_monthViewSwipedLeft);
swipeLeft.Direction = UISwipeGestureRecognizerDirection.Left;
this.AddGestureRecognizer(swipeLeft);
var swipeRight = new UISwipeGestureRecognizer(p_monthViewSwipedRight);
swipeRight.Direction = UISwipeGestureRecognizerDirection.Right;
this.AddGestureRecognizer(swipeRight);
var swipeUp = new UISwipeGestureRecognizer(p_monthViewSwipedUp);
swipeUp.Direction = UISwipeGestureRecognizerDirection.Up;
this.AddGestureRecognizer(swipeUp);
}
开发者ID:Bonelol,项目名称:Xamarin.Forms.Calendar,代码行数:34,代码来源:CalendarMonthView.cs
注:本文中的UISwipeGestureRecognizer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论