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


C# UIPickerView.AddGestureRecognizer方法代码示例

本文整理汇总了C#中UIPickerView.AddGestureRecognizer方法的典型用法代码示例。如果您正苦于以下问题:C# UIPickerView.AddGestureRecognizer方法的具体用法?C# UIPickerView.AddGestureRecognizer怎么用?C# UIPickerView.AddGestureRecognizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UIPickerView的用法示例。


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

示例1: pickerViewModel

        public void pickerViewModel(UITextField textFieldItem, List<string> segmentosStrings, UIButton button)
        {
            PickerModel picker_model_Segmentos = new PickerModel (segmentosStrings);
            UIPickerView picker_Segmentos = new UIPickerView ();
            picker_Segmentos.Model = picker_model_Segmentos;
            picker_Segmentos.ShowSelectionIndicator = true;

            UIToolbar toolbar = new UIToolbar ();
            toolbar.BarStyle = UIBarStyle.Black;
            toolbar.Translucent = true;
            toolbar.SizeToFit ();

            var tapRecognizer = new UITapGestureRecognizer ();

            tapRecognizer.AddTarget(() => {
                Console.WriteLine("CLICK");
            });

            tapRecognizer.NumberOfTapsRequired = 2;
            tapRecognizer.NumberOfTouchesRequired = 1;

            picker_Segmentos.AddGestureRecognizer(tapRecognizer);

            UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Bordered,(s, e) => {
                //				Console.WriteLine((int)picker_Segmentos.SelectedRowInComponent);
                Console.WriteLine(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ());
                textFieldItem.Text = picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ();
                if(button.Tag == 2 || button.Tag == 3){
                    Console.WriteLine("longCode ButtonClicked");
                }

                textFieldItem.ResignFirstResponder ();
            });

            UIBarButtonItem cancelButton = new UIBarButtonItem ("cancel", UIBarButtonItemStyle.Bordered, (s, e) => {
                textFieldItem.ResignFirstResponder ();
            });
            toolbar.SetItems (new UIBarButtonItem[]{ doneButton, cancelButton }, true);
            toolbar.TintColor = UIColor.White;
            textFieldItem.InputView = picker_Segmentos;
            this.View.BackgroundColor = UIColor.Clear;
            textFieldItem.InputAccessoryView = toolbar;
            textFieldItem.AddGestureRecognizer (tapRecognizer);
        }
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:44,代码来源:TSSetupCodeVC.cs

示例2: ViewDidLoad

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

            // set the background view to black so we don't get white aliasing flicker during
            // the pan
            View.BackgroundColor = UIColor.Black;
            View.Layer.AnchorPoint = CGPoint.Empty;


            // scroll view
            ScrollView = new UIScrollViewWrapper( );
            ScrollView.Layer.AnchorPoint = CGPoint.Empty;
            ScrollView.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor );
            ScrollView.Parent = this;
            View.AddSubview( ScrollView );



            // create our keyboard adjustment manager, which works to make sure text fields scroll into visible
            // range when a keyboard appears
            KeyboardAdjustManager = new Rock.Mobile.PlatformSpecific.iOS.UI.KeyboardAdjustManager( View );


            // setup the First Name field
            FirstName = new StyledTextField();
            ScrollView.AddSubview( FirstName.Background );
            ControlStyling.StyleTextField( FirstName.Field, PrayerStrings.CreatePrayer_FirstNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
            ControlStyling.StyleBGLayer( FirstName.Background );

            LastName = new StyledTextField();
            ScrollView.AddSubview( LastName.Background );
            ControlStyling.StyleTextField( LastName.Field, PrayerStrings.CreatePrayer_LastNamePlaceholderText, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
            ControlStyling.StyleBGLayer( LastName.Background );


            PrayerRequestLayer = new UIView();
            ScrollView.AddSubview( PrayerRequestLayer );

            PrayerRequestPlaceholder = new UILabel();
            PrayerRequestLayer.AddSubview( PrayerRequestPlaceholder );

            PrayerRequest = new UITextView();
            PrayerRequestLayer.AddSubview( PrayerRequest );

            // setup the prayer request field, which requires a fake "placeholder" text field
            PrayerRequest.Delegate = new KeyboardAdjustManager.TextViewDelegate( );
            PrayerRequest.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor );
            PrayerRequest.TextContainerInset = UIEdgeInsets.Zero;
            PrayerRequest.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
            PrayerRequest.TextContainer.LineFragmentPadding = 0;
            PrayerRequest.BackgroundColor = UIColor.Clear;
            PrayerRequest.Editable = true;
            PrayerRequest.KeyboardAppearance = UIKeyboardAppearance.Dark;
            PrayerRequestPlaceholder.TextColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor );
            PrayerRequestPlaceholder.BackgroundColor = UIColor.Clear;
            PrayerRequestPlaceholder.Text = PrayerStrings.CreatePrayer_PrayerRequest;
            PrayerRequestPlaceholder.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
            //PrayerRequestPlaceholder.SizeToFit( );
            ControlStyling.StyleBGLayer( PrayerRequestLayer );


            // category layer
            CategoryLayer = new UIView();
            ScrollView.AddSubview( CategoryLayer );

            CategoryButton = new UIButton();
            CategoryLayer.AddSubview( CategoryButton );

            // setup the category picker and selector button
            UILabel categoryLabel = new UILabel( );
            ControlStyling.StyleUILabel( categoryLabel, ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
            categoryLabel.Text = PrayerStrings.CreatePrayer_SelectCategoryLabel;

            PickerAdjustManager = new PickerAdjustManager( View, ScrollView, categoryLabel, CategoryLayer );
            UIPickerView pickerView = new UIPickerView();
            pickerView.Model = new CategoryPickerModel() { Parent = this };
            pickerView.UserInteractionEnabled = true;
            PickerAdjustManager.SetPicker( pickerView );


            // setup a tap gesture for the picker
            Action action = ( ) =>
                {
                    OnToggleCategoryPicker( false );
                };
            UITapGestureRecognizer uiTap = new UITapGestureRecognizer( action );
            uiTap.NumberOfTapsRequired = 1;
            pickerView.AddGestureRecognizer( uiTap );
            uiTap.Delegate = this;


            CategoryButton.TouchUpInside += (object sender, EventArgs e ) =>
                {
                    OnToggleCategoryPicker( true );
                };
            CategoryButton.SetTitle( PrayerStrings.CreatePrayer_CategoryButtonText, UIControlState.Normal );
            CategoryButton.SetTitleColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ), UIControlState.Normal );
            CategoryButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont( ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize );
            CategoryButton.HorizontalAlignment = UIControlContentHorizontalAlignment.Left;
//.........这里部分代码省略.........
开发者ID:Higherbound,项目名称:HBMobileApp,代码行数:101,代码来源:Prayer_CreateUIViewController.cs

示例3: loadAffiliatePickerView

// Use For Actionsheet picker view
		public void loadAffiliatePickerView ()
		{
			List<String> segmentosStrings = new List<String> ();

			if (Constant.affiliateResponse != null) {
				for (int i = 0; i < Constant.affiliateResponse.data.Count; i++) {
					segmentosStrings.Add (Constant.affiliateResponse.data [i].name.ToString());
				}
			}

			picker_model_Segmentos = new PickerModel (segmentosStrings);
			picker_Segmentos = new UIPickerView ();
			picker_Segmentos.Model = picker_model_Segmentos;
			picker_Segmentos.ShowSelectionIndicator = true;

			UIToolbar toolbar = new UIToolbar ();
			toolbar.BarStyle = UIBarStyle.Black;
			toolbar.Translucent = true;
			toolbar.SizeToFit ();

			var tapRecognizer = new UITapGestureRecognizer ();

			tapRecognizer.AddTarget(() => { 
				Console.WriteLine("CLICK");
			});

			tapRecognizer.NumberOfTapsRequired = 2;
			tapRecognizer.NumberOfTouchesRequired = 1;

			picker_Segmentos.AddGestureRecognizer(tapRecognizer);

			UIBarButtonItem doneButton = new UIBarButtonItem ("Done", UIBarButtonItemStyle.Bordered,(s, e) => {
				//				Console.WriteLine((int)picker_Segmentos.SelectedRowInComponent);
				Console.WriteLine(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ());
				affiliateName.SetTitle(picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString (), UIControlState.Normal);
				affName.ResignFirstResponder ();

				for (int i = 0; i < Constant.affiliateResponse.data.Count; i++) {
					if(Constant.affiliateResponse.data [i].name.ToString() == picker_model_Segmentos.values[(int)picker_Segmentos.SelectedRowInComponent(0)].ToString ()){
						Constant.selectedAffialte.data = Constant.affiliateResponse.data[i];
					}
				}
			});

			UIBarButtonItem cancelButton = new UIBarButtonItem ("cancel", UIBarButtonItemStyle.Bordered, (s, e) => {
				affName.ResignFirstResponder ();
			});
			toolbar.SetItems (new UIBarButtonItem[]{ doneButton, cancelButton }, true);
			toolbar.TintColor = UIColor.White;
			affName.InputView = picker_Segmentos;
			this.View.BackgroundColor = UIColor.Black;
			affName.InputAccessoryView = toolbar;
			affName.AddGestureRecognizer (tapRecognizer);

		}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:56,代码来源:TSCustomNavController.cs


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