• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UITapGestureRecognizer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: RegisterKeyboardDismissalHandler

 /**
  * Locates all textfields in the given view and registers a handler to dismiss the keyboard when the user clicks 'Done'
  */
 public static void RegisterKeyboardDismissalHandler(UIView view)
 {
     UITapGestureRecognizer gesture = new UITapGestureRecognizer(() => view.EndEditing(true));
     gesture.CancelsTouchesInView = false; //for iOS5. Otherwise events will not be fired on other controls.
     view.AddGestureRecognizer(gesture);
     RegisterKeyboardDoneHandlers (view);
 }
开发者ID:steveperkins,项目名称:fans-of-fury,代码行数:10,代码来源:KeyboardUtil.cs


示例2: OnElementChanged

        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement == null)
            {
                var label = Control;
                label.TextColor = UIColor.Red;
                label.BackgroundColor = UIColor.Clear;
                label.UserInteractionEnabled = true;
                var tap = new UITapGestureRecognizer();

                tap.AddTarget(() =>
                {
                    var hyperLinkLabel = Element as HyperLinkControl;

                    if (hyperLinkLabel != null)
                    {
                        var uri = hyperLinkLabel.NavigateUri;

                        if (uri.Contains("@") && !uri.StartsWith("mailto:"))
                            uri = string.Format("{0}{1}", "mailto:", uri);
                        else if (uri.StartsWith("www."))
                            uri = string.Format("{0}{1}", @"http://", uri);

                        UIApplication.SharedApplication.OpenUrl(new NSUrl(uri));
                    }
                });

                tap.NumberOfTapsRequired = 1;
                tap.DelaysTouchesBegan = true;
                label.AddGestureRecognizer(tap);
            }
        }
开发者ID:JavierErdozain,项目名称:Events,代码行数:34,代码来源:HyperLinkControlRenderer.cs


示例3: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
            {
                EdgesForExtendedLayout = UIRectEdge.None;
            }

            MvxFluentBindingDescriptionSet<LoginViewController, LoginViewModel> set =
                this.CreateBindingSet<LoginViewController, LoginViewModel>();
            set.Bind(textField_Email).To(vm => vm.Email);
            set.Bind(textField_Password).To(vm => vm.Password);
            set.Bind(btn_Login).To(x => x.LoginCommand);
            set.Apply();

            var gestureRecognizer = new UITapGestureRecognizer(() =>
            {
                textField_Email.ResignFirstResponder();
                textField_Password.ResignFirstResponder();
            });

            View.AddGestureRecognizer(gestureRecognizer);
        }
开发者ID:slown1,项目名称:Xamarin.Chat,代码行数:25,代码来源:LoginViewController.cs


示例4: ViewDidLoad

        /// <summary>
        /// On load initialise the example
        /// </summary>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //Subscribe to the keyboard events
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidHideNotification, HandleKeyboardDidHide);
            NSNotificationCenter.DefaultCenter.AddObserver(UIKeyboard.DidShowNotification, HandleKeyboardDidShow);

            //Remove the keyboard if the screen is tapped
            var tap = new UITapGestureRecognizer();
            tap.AddTarget(() =>
            {
                this.View.EndEditing(true);
            });
            this.View.AddGestureRecognizer(tap);

            //Create the chat application instance
            ChatApplication = new ChatAppiOS(ChatHistory, MessageBox);

            //Uncomment this line to enable logging
            //EnableLogging();

            //Set the default serializer to Protobuf
            ChatApplication.Serializer = DPSManager.GetDataSerializer<NetworkCommsDotNet.DPSBase.ProtobufSerializer>();

			//Get the initial size of the chat view
			ChatApplication.OriginalViewSize = ChatView.Frame;

            //Print out the application usage instructions
            ChatApplication.PrintUsageInstructions();

            //Initialise comms to add the necessary packet handlers
            ChatApplication.RefreshNetworkCommsConfiguration();
        }
开发者ID:MarcFletcher,项目名称:NetworkComms.Net,代码行数:37,代码来源:ChatWindow.cs


示例5: BMarkerImageView

        public BMarkerImageView(WeakReference parentView, CGPoint location)
        {
            WeakParent = parentView;
             _location = location;

             UserInteractionEnabled = true;

             Frame = new CGRect (Location.X - 22, Location.Y - 22, 44, 44);
             using (var image = UIImage.FromFile ("Images/icon_marker.png"))
             {
            Image = image;
             }

             _pan = new UIPanGestureRecognizer (() =>
             {
            if ((_pan.State == UIGestureRecognizerState.Began || _pan.State == UIGestureRecognizerState.Changed) && (_pan.NumberOfTouches == 1))
            {
               Center = _pan.LocationInView (_parent);
               Location = Center;
               _parent.SetNeedsDisplay ();
            }
            else if (_pan.State == UIGestureRecognizerState.Ended)
            {
            }
             });

             _doubleTap = new UITapGestureRecognizer ((gesture) => Crop ()) {
            NumberOfTapsRequired = 2, NumberOfTouchesRequired = 1
             };

             AddGestureRecognizer (_pan);
             AddGestureRecognizer (_doubleTap);
        }
开发者ID:bkmza,项目名称:XamCropBkmzaSampleIOS,代码行数:33,代码来源:BMarkerImageView.cs


示例6: ViewDidLoad

        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;


            var label = new ShapeLabel(new RectangleF(10, 10, 300, 40));
            Add(label);
            var textField = new UITextField(new RectangleF(10, 50, 300, 40));
            Add(textField);
            var shapeView = new ShapeView(new RectangleF(60, 90, 200, 200));
            Add(shapeView);

            var picker = new UIPickerView();
            var pickerViewModel = new MvxPickerViewModel(picker);
            picker.Model = pickerViewModel;
            picker.ShowSelectionIndicator = true;
            textField.InputView = picker;

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            set.Bind(label).For(s => s.TheShape).To(vm => vm.Shape);
            set.Bind(textField).To(vm => vm.Shape);
            set.Bind(pickerViewModel).For(p => p.ItemsSource).To(vm => vm.List);
            set.Bind(pickerViewModel).For(p => p.SelectedItem).To(vm => vm.Shape);
            set.Bind(shapeView).For(s => s.TheShape).To(vm => vm.Shape);
            set.Apply();

            var g = new UITapGestureRecognizer(() => textField.ResignFirstResponder());
            View.AddGestureRecognizer(g);
        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:34,代码来源:FirstView.cs


示例7: AddGestures

        private void AddGestures()
        {
            var touchDownGesture = new UILongPressGestureRecognizer(HandleTouchDown) { MinimumPressDuration = 0 };
            _canvasView.AddGestureRecognizer(touchDownGesture);

            // Tap to select
            var tapGesture = new UITapGestureRecognizer(HandleTap);
            _canvasView.AddGestureRecognizer(tapGesture);

            // Move an element
            var elementDragGesture = new UIPanGestureRecognizer(HandlePan);
            _canvasView.AddGestureRecognizer(elementDragGesture);

            elementDragGesture.ShouldBegin = g => _panShouldBegin;

            var selectLongPressGesture = new UILongPressGestureRecognizer(HandleLongPress) { MinimumPressDuration = 0.1 };
            _canvasView.AddGestureRecognizer(selectLongPressGesture);

            selectLongPressGesture.ShouldReceiveTouch = (g, touch) =>
            {
                var locationInCanvas = touch.LocationInView(_canvasView);
                var touchedElement = ElementUnderPoint(locationInCanvas);

                return touchedElement != null && !IsElementSelected(touchedElement);
            };

            selectLongPressGesture.ShouldRecognizeSimultaneously = (g1, g2) => g2 == elementDragGesture;
            touchDownGesture.ShouldRecognizeSimultaneously = (g1, g2) => true;
        }
开发者ID:TheRealAdamKemp,项目名称:GestureRecognizerPresentation,代码行数:29,代码来源:GestureViewController.cs


示例8: ViewDidLoad

        public override void ViewDidLoad()
        {
            View = new UIView {BackgroundColor = UIColor.White};
            NavigationItem.Title = "Search Movies";

            base.ViewDidLoad ();

            UITextField keywordView = CreateAndAddKeywordView();
            UIButton searchButton = CreateAndAddSearchButton();
            UITableView tableView = CreateAndAddTableView();

            var source = new MvxStandardTableViewSource(tableView, "TitleText title;");
            var bindingSet = this.CreateBindingSet<FirstView, FirstViewModel>();
            bindingSet.Bind(source).To(viewModel => viewModel.Movies);
            bindingSet.Bind(keywordView).To(viewModel => viewModel.Keyword);
            bindingSet.Bind(searchButton).To(viewModel => viewModel.SearchCommand);
            bindingSet.Bind(source).For(x => x.SelectionChangedCommand).To(viewModel => viewModel.ShowDetailCommand);
            bindingSet.Apply();

            tableView.Source = source;
            tableView.ReloadData();

            var responder = new UITapGestureRecognizer (() => keywordView.ResignFirstResponder ());
            responder.CancelsTouchesInView = false;
            View.AddGestureRecognizer(responder);
        }
开发者ID:sschoeb,项目名称:MovieFinder,代码行数:26,代码来源:FirstView.cs


示例9: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

             // set the background color of the view to white
             this.View.BackgroundColor = UIColor.White;

             this.Title = "Mecut Dosya";

             // create our scroll view
             scrollView = new UIScrollView (
            new RectangleF (0, 0, View.Frame.Width
               , View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
             View.AddSubview (scrollView);

             string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
             string localFilename = "original.jpg";
             string localPath = Path.Combine(documentsPath, localFilename);

             // create our image view
             imageView = new UIImageView (UIImage.FromFile (localPath));
             scrollView.ContentSize = imageView.Image.Size;
             scrollView.AddSubview (imageView);

             // set allow zooming
             scrollView.MaximumZoomScale = 3f;
             scrollView.MinimumZoomScale = .1f;
             scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };

             // configure a double-tap gesture recognizer
             UITapGestureRecognizer doubletap = new UITapGestureRecognizer();
             doubletap.NumberOfTapsRequired = 2;
             doubletap.AddTarget (this, new MonoTouch.ObjCRuntime.Selector("DoubleTapSelector"));
             scrollView.AddGestureRecognizer(doubletap);
        }
开发者ID:hhempel,项目名称:StoryboardTables,代码行数:35,代码来源:imageViewCode.cs


示例10: OnElementChanged

        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement != null)
            {
                // Get the forms view
                _formsView = (HexagonButtonView)e.NewElement;

                // Enable user interaction on the image view
                this.Control.UserInteractionEnabled = true;

                // Set up a tap gesture recognizer
                UITapGestureRecognizer tapGesture = null;

                Action action = () => {
                    // Check if the touch is on a transparent part of the image
                    if (IsPixelTransparent(tapGesture.LocationOfTouch(0, this.Control), this.Control.Image) == false) {
                        // Execute the click event
                        _formsView.Click();
                    }
                };

                tapGesture = new UITapGestureRecognizer(action);

                this.Control.AddGestureRecognizer(tapGesture);
            }
        }
开发者ID:Manne990,项目名称:XamTest,代码行数:28,代码来源:HexagonButtonViewRenderer.cs


示例11: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Perform any additional setup after loading the view, typically from a nib.
            var g = new UITapGestureRecognizer (() => View.EndEditing (true));
            g.CancelsTouchesInView = false; //for iOS5
            View.AddGestureRecognizer (g);

            txtFirst.Text = "John";
            txtLast.Text = "Smith";
            txtAddress.Text = "123 Nowhere Ln.";
            txtCity.Text = "Beverly Hills";
            txtState.Text = "CA";
            txtZip.Text = "90210-0000";
            txtIPAddress.Text = "10.244.43.106";

            txtCardNumber.Text = "4832419131427146";
            txtExpMonth.Text = "01";
            txtExpYear.Text = "2017";
            txtCVV.Text = "123";

            txtTxnAmount.Text = "12.88";
            txtTxnDescription.Text = "Test Transaction";
        }
开发者ID:meetdpanda,项目名称:Gala,代码行数:25,代码来源:DirectpaymentViewController.cs


示例12: 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


示例13: SlideoutNavigationController

        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 260f;
            SlideHeight = 44f;
            LayerShadowing = true;

            _internalMenuView = new ProxyNavigationController
                                    {
                                        ParentController = this,
                                        View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
                                    };
            //_internalMenuView.SetNavigationBarHidden(true, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer();
            //            _tapGesture.AddTarget(new )
            _tapGesture.AddTarget(Hide);
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer
                              {
                                  Delegate = new SlideoutPanDelegate(this),
                                  MaximumNumberOfTouches = 1,
                                  MinimumNumberOfTouches = 1
                              };
            _panGesture.AddTarget(() => Pan(_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer(_panGesture);
        }
开发者ID:sinhpham,项目名称:Harvest_Loss,代码行数:34,代码来源:SlideoutNavigationController.cs


示例14: ViewDidLoad

		public override void ViewDidLoad(){
			this.TableView = new UITableView (this.View.Bounds, UITableViewStyle.Grouped);
			base.ViewDidLoad ();
			this.View.AddSubview (this.TableView);

			UITapGestureRecognizer doubleTap = new UITapGestureRecognizer ();
			doubleTap.NumberOfTapsRequired = 2;
			this.View.AddGestureRecognizer (doubleTap);

			UITapGestureRecognizer twoFingerDoubleTap = new UITapGestureRecognizer ();
			twoFingerDoubleTap.NumberOfTapsRequired = 2;
			twoFingerDoubleTap.NumberOfTouchesRequired = 2;
			this.View.AddGestureRecognizer (twoFingerDoubleTap);

			this.SetupLeftButton ();
			this.SetupRightButton ();

			UIColor barColor = new UIColor (247.0F / 255.0F, 249.0F / 255.0F, 250.0F / 255.0F, 1.0F);
			this.NavigationController.NavigationBar.BarTintColor = barColor;

			MMLogoView logo = new MMLogoView (new RectangleF (0F, 0F, 29F, 31F));
			this.NavigationItem.TitleView = logo;
			this.NavigationController.View.Layer.CornerRadius = 10.0F;

			UIView backView = new UIView ();
			backView.BackgroundColor = new UIColor (208.0F / 255.0F, 208.0F / 255.0F, 208.0F / 255.0F, 1.0F);
			this.TableView.BackgroundView = backView;
		}
开发者ID:adlair,项目名称:MMDrawerController,代码行数:28,代码来源:MMExampleCenterTableViewController.cs


示例15: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;
			
			// Perform any additional setup after loading the view, typically from a nib.
            var set = this.CreateBindingSet<AddView, AddViewModel>();
            set.Bind(CaptionText).To(vm => vm.Caption);
            set.Bind(NotesText).To(vm => vm.Notes);
            set.Bind(AddPictureButton).To(vm => vm.AddPictureCommand);
            set.Bind(SaveButton).To(vm => vm.SaveCommand);
            set.Bind(LocationSwitch).To(vm => vm.LocationKnown);
            set.Bind(MainImageView).To(vm => vm.PictureBytes).WithConversion("InMemoryImage");
            set.Apply();

		    var g = new UITapGestureRecognizer(() =>
		        {
		            CaptionText.ResignFirstResponder();
		            NotesText.ResignFirstResponder();

		        });

            View.AddGestureRecognizer(g);
		}
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:27,代码来源:AddView.cs


示例16: 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


示例17: tapGame

		void tapGame (UITapGestureRecognizer gestureRecognizer)
		{
			if (gestureRecognizer.State == UIGestureRecognizerState.Recognized &&
				DidSelect != null) {
				CGPoint point = gestureRecognizer.LocationInView (this);
				CGRect bounds = Bounds;

				CGPoint normalizedPoint = point;
				normalizedPoint.X -= bounds.X + bounds.Size.Width / 2;
				normalizedPoint.X *= 3 / bounds.Size.Width;
				normalizedPoint.X = (float)Math.Round (normalizedPoint.X);
				normalizedPoint.X = (float)Math.Max (normalizedPoint.X, -1);
				normalizedPoint.X = (float)Math.Min (normalizedPoint.X, 1);
				TTTMoveXPosition xPosition = (TTTMoveXPosition)(int)normalizedPoint.X;

				normalizedPoint.Y -= bounds.Y + bounds.Size.Height / 2;
				normalizedPoint.Y *= 3 / bounds.Size.Height;
				normalizedPoint.Y = (float)Math.Round (normalizedPoint.Y);
				normalizedPoint.Y = (float)Math.Max (normalizedPoint.Y, -1);
				normalizedPoint.Y = (float)Math.Min (normalizedPoint.Y, 1);
				TTTMoveYPosition yPosition = (TTTMoveYPosition)(int)normalizedPoint.Y;

				if (CanSelect == null || CanSelect (this, xPosition, yPosition))
					DidSelect (this, xPosition, yPosition);
			}
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:26,代码来源:TTTGameView.cs


示例18: ViewDidLoad

        public override void ViewDidLoad()
        {
            View = new UIView(){ BackgroundColor = UIColor.White};
            base.ViewDidLoad();

            // ios7 layout
            if (RespondsToSelector(new Selector("edgesForExtendedLayout")))
                EdgesForExtendedLayout = UIRectEdge.None;

            var binaryEdit = new BinaryEdit(new RectangleF(10, 70, 300, 120));
            Add(binaryEdit);
            var textField = new UITextField(new RectangleF(10, 190, 300, 40));
            Add(textField);
            var nicerBinaryEdit = new NicerBinaryEdit(new RectangleF(10, 260, 300, 120));
            Add(nicerBinaryEdit);

            var set = this.CreateBindingSet<FirstView, Core.ViewModels.FirstViewModel>();
            // to remove the need for `For("N28")` see Setup.FillBindingNames
            set.Bind(binaryEdit).For("N28").To(vm => vm.Counter);
            set.Bind(textField).To(vm => vm.Counter);
            // to remove the need for `For(be => be.MyCount)` see Setup.FillBindingNames
            set.Bind(nicerBinaryEdit).For(be => be.MyCount).To(vm => vm.Counter);
            set.Apply();

            var tap = new UITapGestureRecognizer(() => textField.ResignFirstResponder());
            View.AddGestureRecognizer(tap);
        }
开发者ID:KiranKumarAlugonda,项目名称:NPlus1DaysOfMvvmCross,代码行数:27,代码来源:FirstView.cs


示例19: ViewDidLoad

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            
            NavigationItem.LeftBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);
            NavigationItem.LeftBarButtonItem.Clicked += (sender, e) => {
                this.NavigationController.PopViewController(true);
            };
            NavigationItem.RightBarButtonItem = new UIBarButtonItem (UIBarButtonSystemItem.Done);

            NavigationItem.RightBarButtonItem.Clicked += async (sender, e) => {
                await SaveCheckin();
            };

            mapView.DidUpdateUserLocation += (sender, e) => {
                if (mapView.UserLocation != null) {
                    CLLocationCoordinate2D coords = mapView.UserLocation.Coordinate;
                    UpdateMapLocation(coords);
                }
            };

            UITapGestureRecognizer doubletap = new UITapGestureRecognizer();
            doubletap.NumberOfTapsRequired = 1; // double tap
            doubletap.AddTarget (this, new ObjCRuntime.Selector("ImageTapped"));
            imageView.AddGestureRecognizer(doubletap); 

            _dataSource = new LocationsDataSource (this);
            tableLocations.Source = _dataSource;

            txtComment.ShouldEndEditing += (tf) => {
                tf.ResignFirstResponder();
                return true;
            };
        }
开发者ID:jeacott,项目名称:Buddy-DotNET-SDK,代码行数:34,代码来源:AddCheckinViewController.cs


示例20: ViewDidLoad

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();

            View.Apply (Style.Screen);
            NavigationBar.Apply (Style.NavigationBar);
            Delegate = new NavDelegate ();

            tapGesture = new UITapGestureRecognizer (OnTapGesture) {
                ShouldReceiveTouch = (a, b) => true,
                ShouldRecognizeSimultaneously = (a, b) => true,
                CancelsTouchesInView = true
            };

            panGesture = new UIPanGestureRecognizer (OnPanGesture) {
                // TODO: TableView scroll gestures are not
                // compatible with the open / close pan gesture.
                ShouldRecognizeSimultaneously = (a, b) => ! (b.View is UITableView),
                CancelsTouchesInView = true,
            };

            View.AddGestureRecognizer (tapGesture);
            View.AddGestureRecognizer (panGesture);

            fadeView = new UIView();
            fadeView.BackgroundColor = UIColor.FromRGBA (29f / 255f, 29f / 255f, 28f / 255f, 0.5f);
            fadeView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height);
            fadeView.Hidden = true;
            View.Add (fadeView);
        }
开发者ID:marknotgeorge,项目名称:mobile,代码行数:30,代码来源:MainViewController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UITestControl类代码示例发布时间:2022-05-24
下一篇:
C# UITableViewStyle类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap