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


C# UIPickerView.Select方法代码示例

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


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

示例1: Selected

 public override void Selected(UIPickerView picker, nint row, nint component)
 {
     if(component == 0 && row > picker.SelectedRowInComponent(1))
     {
         picker.Select(row, 1, true);
     }
     if(component == 1 && row < picker.SelectedRowInComponent(0))
     {
         picker.Select(row, 0, true);
     }
 }
开发者ID:evnik,项目名称:UIFramework,代码行数:11,代码来源:RangePicker.iOS.cs

示例2: Selected

 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     model = new CounterPickerDataModel(model.Counter);
     var vc = new MyViewController (this) {
         Autorotate = dvc.Autorotate
     };
     counterPicker = CreatePicker ();
     counterPicker.Frame = PickerFrameWithSize (counterPicker.SizeThatFits (SizeF.Empty));
     counterPicker.Model = model;
     for (int d = 0; d < model.Items.Count; d++) {
         counterPicker.Select(model.SelectedIndex[d], d, true);
     }
     vc.View.BackgroundColor = UIColor.Black;
     vc.View.AddSubview (counterPicker);
     dvc.ActivateController (vc);
 }
开发者ID:austinvernsonger,项目名称:monotouch-element-pack,代码行数:16,代码来源:CounterElement.cs

示例3: PickerAlert

        public PickerAlert(string[] values, int currentSelected, Action<int> selected)
            : base(new RectangleF(0, 0, 320f, 480f))
        {
            AutosizesSubviews = true;
            this.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            _values = values;
            _currentSelected = currentSelected;
            _selected = selected;

            _pickerView = new UIPickerView();
            _pickerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            _pickerView.ShowSelectionIndicator = true;
            _pickerView.Model = new PickerModel(values);
            _pickerView.BackgroundColor = UIColor.FromRGB(244, 244, 244);
            _pickerView.Select(currentSelected, 0, false);

            _toolbar = new UIToolbar();
            _toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;

            _toolbar.Items = new UIBarButtonItem[]
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => {
                    _selected(_pickerView.SelectedRowInComponent(0));
                    Dismiss();
                })
            };

            _innerView = new UIView(new RectangleF(0, Frame.Height, Frame.Width, 44f + _pickerView.Frame.Height));
            _innerView.AutosizesSubviews = true;
            _innerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;

            _toolbar.Frame = new RectangleF(0, 0, Frame.Width, 44f);
            _innerView.Add(_toolbar);

            _pickerView.Frame = new RectangleF(0, 44f, Frame.Width, _pickerView.Frame.Height);
            _innerView.Add(_pickerView);

            Add(_innerView);
        }
开发者ID:rcaratchuk,项目名称:CodeFramework,代码行数:41,代码来源:PickerAlert.cs

示例4: Selected

        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            model = new TimePickerDataModel(model.Time);
            var vc = new MyViewController (this) {
                Autorotate = dvc.Autorotate
            };
            counterPicker = CreatePicker ();
            counterPicker.Frame = PickerFrameWithSize (counterPicker.SizeThatFits (SizeF.Empty));
            counterPicker.Model = model;
            for (int d = 0; d < model.Times.Count; d++) {
                counterPicker.Select(model.SelectedIndex[d], d, true);
            }

            // pass value changed
            model.ValueChanged += delegate {
                if (this.ValueChanged != null) {
                    Value = model.FormatValue ();

                    this.ValueChanged (this, new EventArgs ());
                }
            };

            vc.View.BackgroundColor = backgroundColor;
            vc.View.AddSubview (counterPicker);
            dvc.ActivateController (vc);
        }
开发者ID:dan-pennyfarthingapps,项目名称:PennyFarElements,代码行数:26,代码来源:TimeWithSecondsPickerElement.cs

示例5: CreatePicker_PrivacyLevels

		private void CreatePicker_PrivacyLevels()
		{
			// Create Picker 
			var picker = new UIPickerView ();
			picker.Model = new PrivacyLevelViewModel(prayerService.PrivacyLevels);
			picker.ShowSelectionIndicator = true;

			// Create Toolbar for Picker
			UIToolbar toolbar = new UIToolbar ();
			toolbar.BarStyle = UIBarStyle.Black;
			toolbar.Translucent = true;
			toolbar.SizeToFit ();

			// Event Handler for Done Button on Drop Down
			UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,(s,e) =>
				{
					foreach (UIView view in this.View.Subviews) 
					{
						if (view.IsFirstResponder)
						{
							UITextField textview = (UITextField)view;
							var pickerItem = picker.Model as PrivacyLevelViewModel;
							textview.Text = pickerItem.SelectedItem.Level; 
							textview.ResignFirstResponder ();
						}
					}

				} );
			toolbar.SetItems (new UIBarButtonItem[]{doneButton},true);

			// Set Textbox to use Picker
			txtPrivacy.InputView = picker;
			txtPrivacy.InputAccessoryView = toolbar;

			// Select Item currently in Textbox
			txtPrivacy.TouchDown += (sender, e) => {
				UITextField field = (UITextField)sender;
				var index = 0;
				if (field.Text != ""){
					index = prayerService.PrivacyLevels.FindIndex (a => a.Level == field.Text);
				}
				picker.Select (index, 0, true);
			} ;

		}
开发者ID:soleary1222,项目名称:prayerapplication,代码行数:45,代码来源:ManagePrayerController.cs

示例6: actionChangeKey

        partial void actionChangeKey(NSObject sender)
        {
            _actionSheet = new UIActionSheet("Title", null, string.Empty, string.Empty, null);

            var pickerView = new UIPickerView(new RectangleF(0, 44, 320, 300));
            pickerView.ShowSelectionIndicator = true;
            pickerView.WeakDelegate = this;

            var toolbar = new UIToolbar(new RectangleF(0, 0, 320, 44));
            toolbar.BarStyle = UIBarStyle.Black;

            UIBarButtonItem flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            var button = new UIButton(UIButtonType.Custom);
            button.SetTitle("Done", UIControlState.Normal);
            button.Layer.CornerRadius = 8;
            button.Layer.BackgroundColor = GlobalTheme.SecondaryColor.CGColor;
            button.Font = UIFont.FromName("HelveticaNeue-Bold", 12.0f);
            button.Frame = new RectangleF(0, 20, 60, 30);
            button.TouchUpInside += (sender2, e) => {
                int key = _keys[pickerView.SelectedRowInComponent(0)].Item1;
                OnChangeKey(key);
                _actionSheet.DismissWithClickedButtonIndex(0, true);
            };
            var btnDone = new UIBarButtonItem(button);
            toolbar.SetItems(new UIBarButtonItem[2] { flexSpace, btnDone }, true);

            _actionSheet.AddSubview(toolbar);
            _actionSheet.AddSubview(pickerView);
            _actionSheet.ShowInView(UIApplication.SharedApplication.KeyWindow);
            _actionSheet.Bounds = new RectangleF(0, 0, 320, 344);

            int index = _keys.IndexOf(_currentKey);
            pickerView.Select(index, 0, false);
        }
开发者ID:pascalfr,项目名称:MPfm,代码行数:35,代码来源:PitchShiftingViewController.cs

示例7: UpdateSelectedItems

            /// <summary>
            /// Updates the selected items.
            /// </summary>
            /// <param name="picker">Picker.</param>
            /// <param name="value">Value.</param>
            public void UpdateSelectedItems(UIPickerView picker,object value)
            {
                if (value == null)
                    SelectedItems = null;

                if (value is object[])
                {
                    var vals = (object[])value;

                    var aMsg = String.Empty;

                    for (int index = 0; index < vals.Length; index++)
                    {
                        var theVal = vals[index];

                        if (mDataDict.Count == 0)
                            return;

                        var aList = mDataDict[index];

                        if (theVal is int)
                        {
                            //index of the selected item
                            var iVal = (int)theVal;

                            if (iVal < aList.Items.Count
                                && iVal >= 0)
                            {
                                var aItem = aList.Items[iVal];

                                aMsg += aItem.DisplayValue + mTableViewCell.SeperatorCharacter;
                            }

                            picker.Select(iVal,index,true);
                        }
                        else if (theVal is string)
                        {
                            //selected value of the selected item
                            var sVal = (string)theVal;

                            foreach (var aItem in aList.Items)
                            {
                                if (aItem.SelectedValue != null
                                    && aItem.SelectedValue is String)
                                {
                                    if (((string)aItem.SelectedValue).ToLower().Equals(sVal.ToLower()))
                                    {
                                        picker.Select(aList.Items.IndexOf(aItem),index,true);

                                        aMsg += aItem.DisplayValue + mTableViewCell.SeperatorCharacter;
                                    }
                                }
                                else if (aItem.SelectedValue != null)
                                {
                                    if (aItem.SelectedValue == theVal)
                                    {
                                        picker.Select(aList.Items.IndexOf(aItem),index,true);

                                        aMsg += aItem.DisplayValue + mTableViewCell.SeperatorCharacter;
                                    }
                                }

                            }

                        }
                    }

                    if (aMsg.EndsWith(mTableViewCell.SeperatorCharacter))
                        aMsg = aMsg.Substring(0,aMsg.LastIndexOf(mTableViewCell.SeperatorCharacter));

                    mTableViewCell.RightLabel.Text = aMsg;

                    SelectedItems = vals;
                }
            }
开发者ID:newky2k,项目名称:PickerCells,代码行数:80,代码来源:PickerViewCell.cs

示例8: UpdateSelection

		public void UpdateSelection(UIPickerView uipv)
		{
			if(selectedInches > 0)
			{
				for(int i = 0; i < Inches.Length; i++)
				{
					if(Inches[i] == selectedInches.ToString())
					{
						uipv.Select(i, 0, true);
						break;
					}
				}
			}
			
			if(selectedFraction != null)
			{
				for(int i = 0; i < Fractions.Length; i++)
				{
					if(Fractions[i] == selectedFraction.ToString())
					{
						uipv.Select(i, 1, true);
						break;
					}
				}
			}
			
		}
开发者ID:SuperYeti,项目名称:MonoTouch.Dialog.Extensions,代码行数:27,代码来源:InchFractionPickerModel.cs

示例9: CreateHoursField

 private UIPickerView CreateHoursField()
 {
     var hoursField = new UIPickerView()
     {
         Frame = new CGRect(100, 200, View.Bounds.Width - 120, 40),
     };
     hoursField.Model = new TimesheetEntryHoursViewModel();
     hoursField.Select(32, 0, true);
     return hoursField;
 }
开发者ID:teamtam,项目名称:xamarin-timesheet,代码行数:10,代码来源:TimesheetEntryController.cs


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