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


C# UIToolbar类代码示例

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


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

示例1: ViewDidLoad

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

            _table = new UITableView (new RectangleF (0, 44, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 44), UITableViewStyle.Plain);
            this.View.AddSubview (_table);

            _toolbar = new UIToolbar ();
            _toolbar.BarStyle = UIBarStyle.Black;
            _toolbar.Frame = new RectangleF (0, 0, UIScreen.MainScreen.Bounds.Width, 44);
            this.View.AddSubview (_toolbar);

            _editButton = new UIBarButtonItem ();
            _editButton.Style = UIBarButtonItemStyle.Bordered;
            _editButton.Title = "Edit";
            _editButton.Clicked += delegate {
                if (_table.Editing) {
                    _table.SetEditing (false, true);
                    _editButton.Title = "Edit";
                } else {
                    _table.SetEditing (true, true);
                    _editButton.Title = "Done";
                }
            };

            _closeButton = new UIBarButtonItem ();
            _closeButton.Style = UIBarButtonItemStyle.Bordered;
            _closeButton.Title = "Close";
            _closeButton.Clicked += delegate {
                SelectedSpeechItem = null;
                this.DismissModalViewControllerAnimated (true);
            };

            _toolbar.Items = new UIBarButtonItem[] { _closeButton, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), _editButton };
        }
开发者ID:mikebluestein,项目名称:TalkBot,代码行数:35,代码来源:SpeechItemTableController.cs

示例2: ViewDidLoad

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

            table = new UITableView (new RectangleF (0, 64, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height - 44), UITableViewStyle.Plain);
            View.AddSubview (table);

            toolbar = new UIToolbar ();
            toolbar.BarStyle = UIBarStyle.Default;
            toolbar.Frame = new RectangleF (0, 20, UIScreen.MainScreen.Bounds.Width, 44);
            View.AddSubview (toolbar);

            editButton = new UIBarButtonItem ();
            editButton.Style = UIBarButtonItemStyle.Bordered;
            editButton.Title = "Edit";
            editButton.Clicked += delegate {
                if (table.Editing) {
                    table.SetEditing (false, true);
                    editButton.Title = "Edit";
                } else {
                    table.SetEditing (true, true);
                    editButton.Title = "Done";
                }
            };

            closeButton = new UIBarButtonItem ();
            closeButton.Style = UIBarButtonItemStyle.Bordered;
            closeButton.Title = "Close";
            closeButton.Clicked += delegate {
                SelectedSpeechItem = null;
                DismissViewController (true, null);
            };

            toolbar.Items = new UIBarButtonItem[] { closeButton, new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace), editButton };
        }
开发者ID:mikebluestein,项目名称:TalkBot,代码行数:35,代码来源:SpeechItemTableController.cs

示例3: AddDoneButton

        /// <summary>
        /// Add toolbar with Done button
        /// </summary>
        protected void AddDoneButton()
        {
            UIToolbar toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f));

            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate
            {
                this.Control
                    .ResignFirstResponder();
            });

            toolbar.Items = new UIBarButtonItem[]
            {
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                doneButton
            };

            Control.InputAccessoryView = toolbar;
            /*
            var protocol = Runtime.GetProtocol("UITextField");

            UITextField searchBarField;
            foreach (UIView subView in Control.Subviews)
            {
                if (subView.ConformsToProtocol(protocol))
                {
                    searchBarField = (UITextField) subView;
                    searchBarField.InputAccessoryView = toolbar;
                }
            }*/
        }
开发者ID:unger,项目名称:ArtportalenApp,代码行数:33,代码来源:CustomSearchBarRenderer.cs

示例4: Create

		public static PriceTileViewCell Create ()
		{
			PriceTileViewCell created = (PriceTileViewCell)Nib.Instantiate (null, null) [0];
			created.ContentView.BackgroundColor = Styles.RTDarkerBlue;

			created.Notional.Delegate = new NotionalTextFieldDelegate (created);

			var numberToolbar = new UIToolbar (new RectangleF(0.0f, 0.0f, created.Frame.Size.Width, 40.0f));

			numberToolbar.Items = new UIBarButtonItem[] {
				new UIBarButtonItem ("Cancel", UIBarButtonItemStyle.Bordered, created, new MonoTouch.ObjCRuntime.Selector ("CancelNumberPad")),
				new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
				new UIBarButtonItem (UIBarButtonSystemItem.Done, created, new MonoTouch.ObjCRuntime.Selector ("DoneNumberPad"))
			};

			created.Notional.InputAccessoryView = numberToolbar;

			//
			// TODO: Reinstate change of notional currency once data model / back end support this.
			// For now we just disable the button (not that some relevant implementation of the button click remains).
			//

			created.NotionalCCY.UserInteractionEnabled = false;


			UserModel.Instance.OnChanged
				.Subscribe (created.OnUserModelChanged);
			created.DecorateWithTradingEnabled (UserModel.Instance.OneTouchTradingEnabled);

			return created;
		}
开发者ID:GDownes,项目名称:ReactiveTrader,代码行数:31,代码来源:PriceTileViewCell.cs

示例5: UIBlurView

 public UIBlurView()
 {
     BackgroundColor = UIColor.Clear;
     Add(toolbar = new UIToolbar {
         Translucent  =true,
     });
 }
开发者ID:Clancey,项目名称:iOSHelpers,代码行数:7,代码来源:UIBlurView.cs

示例6: ViewDidLoad

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

            // Create toolbar, title label and button
            var toolBar = new UIToolbar(new RectangleF(0, 0, View.Bounds.Width, 44));
            toolBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleBottomMargin;
            toolBar.BarStyle = UIBarStyle.Black;
            var toolBarTitle = new UILabel(new RectangleF(0, 0, View.Bounds.Width, 44));
            toolBarTitle.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            toolBarTitle.BackgroundColor = UIColor.Clear;
            toolBarTitle.TextAlignment = UITextAlignment.Center;
            toolBarTitle.TextColor = UIColor.White;
            toolBarTitle.Font = UIFont.SystemFontOfSize(18.0f);
            toolBarTitle.Text = "Note".t();
            var btnNavigate = new UIButton(new RectangleF(5, 5, 30, 30));
            btnNavigate.SetImage(UIImage.FromFile("Images/Toolbar/Save32.png"), UIControlState.Normal);
            btnNavigate.TouchUpInside += delegate {
                _Note.Note = _TxtNote.Text;
                MgrAccessor.DocumentNoteMgr.Save(_Note);
                _PopoverController.Dismiss(true);
            };
            toolBar.AddSubview(toolBarTitle);
            toolBar.AddSubview(btnNavigate);
            View.AddSubview(toolBar);

            // Create text note
            _TxtNote = new UITextView(new RectangleF(0, 44, View.Bounds.Width, View.Bounds.Height));
            _TxtNote.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            _TxtNote.Font = UIFont.SystemFontOfSize(17.0f);
            _TxtNote.Text = _Note.Note;
            View.AddSubview(_TxtNote);
        }
开发者ID:kenLa,项目名称:mTouch-PDFReader,代码行数:33,代码来源:NoteViewController.cs

示例7: ViewDidLoad

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

            for (int i = 0; i<3; i++) {
                this.AddItem ();
            }
            this.dataSource.ItemSource = this.items;

            this.toolbar = new UIToolbar(new CGRect(0, this.View.Bounds.Y, this.View.Frame.Width, 44));
            this.toolbar.Items = new UIBarButtonItem[]{
                new UIBarButtonItem("Add", UIBarButtonItemStyle.Plain, this.AddTouched),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem("Remove", UIBarButtonItemStyle.Plain, this.RemoveTouched),
                new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace),
                new UIBarButtonItem("Update", UIBarButtonItemStyle.Plain, this.UpdateTouched),
            };
            toolbar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            this.View.AddSubview (toolbar);

            this.listView = new TKListView (new CGRect(0, this.View.Bounds.Y + 44, this.View.Frame.Width, this.View.Bounds.Height - 44));
            this.listView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
            this.listView.WeakDataSource = this.dataSource;
            this.listView.Delegate = new ListViewDelegate(this);
            this.View.AddSubview (this.listView);

            this.toolbar.Items[2].Enabled = false;
            this.toolbar.Items[4].Enabled = false;
        }
开发者ID:tremors,项目名称:ios-sdk,代码行数:29,代码来源:ListViewUpdate.cs

示例8: ViewDidLoad

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

			//Text Field
			message = new UITextField(new RectangleF(0, 0, 240, 32))
			{
				BorderStyle = UITextBorderStyle.RoundedRect,
				ReturnKeyType = UIReturnKeyType.Send,
				ShouldReturn = _ =>
				{
					Send();
					return false;
				},
			};

			//Bar button item
			send = new UIBarButtonItem("Send", UIBarButtonItemStyle.Plain, (sender, e) => Send());

			//Toolbar
			toolbar = new UIToolbar(new RectangleF(0, TableView.Frame.Height - 44, TableView.Frame.Width, 44));
			toolbar.Items = new UIBarButtonItem[]
			{
				new UIBarButtonItem(message),
				send
			};
			NavigationController.View.AddSubview(toolbar);

			TableView.Source = new TableSource();
			TableView.TableFooterView = new UIView(new RectangleF(0, 0, TableView.Frame.Width, 44))
			{
				BackgroundColor = UIColor.Clear,
			};
		}
开发者ID:AnnMarieTorres,项目名称:XamChat,代码行数:34,代码来源:MessagesController.cs

示例9: UIMonthTextField

        public UIMonthTextField(IntPtr handle)
            : base(handle)
        {
            monthPicker = new MonthPickerView();

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

            // Create a 'done' button for the toolbar
            UIBarButtonItem unitDoneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done, (s, e) => {
                this.Text = monthPicker.SelectedDate.ToString(this.format);
                this._currentDate = monthPicker.SelectedDate;
                this.ResignFirstResponder();
            });

            // Create flexible space
            UIBarButtonItem unitFlex = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            // Add button and unitFlexible space to the toolbar
            toolbar.SetItems(new UIBarButtonItem[]{unitFlex, unitDoneButton}, true);

            // Tell the textbox to use the picker for input
            this.InputView = monthPicker;

            // Display the toolbar over the pickers
            this.InputAccessoryView = toolbar;
        }
开发者ID:bertouttier,项目名称:ExpenseApp-Mono,代码行数:30,代码来源:UIMonthTextField.cs

示例10: ViewDidLoad

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

			UIDatePicker datePicker = new UIDatePicker ();
			datePicker.Mode = UIDatePickerMode.Date;
			datePicker.BackgroundColor = UIColor.White;

			datePicker.MinimumDate = DateTime.Today.AddDays(-7);
			datePicker.MaximumDate = DateTime.Today.AddDays(7);

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

			UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
				(s, e) => {
					DateTime dateTime = DateTime.SpecifyKind(datePicker.Date, DateTimeKind.Unspecified);
					this.textField.Text = dateTime.ToString("MM-dd-yyyy");
					this.textField.ResignFirstResponder();
				});
			toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);

			this.textField.InputAccessoryView = toolbar;
			
			textField.InputView = datePicker;
		}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:28,代码来源:DatePickerExampleViewController.cs

示例11: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            navBar = new UIToolbar ();
            navBar.Frame = new RectangleF (0, this.View.Frame.Height-130, this.View.Frame.Width, 40);

            items = new UIBarButtonItem [] {
                new UIBarButtonItem ("Back", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoBack (); }),
                new UIBarButtonItem ("Forward", UIBarButtonItemStyle.Bordered, (o, e) => { webView.GoForward (); }),
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => { webView.Reload (); }),
                new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => { webView.StopLoading (); })
            };
            navBar.Items = items;

            SetNavBarColor();

            webView = new UIWebView ();
            webView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height-130);

            webView.LoadStarted += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true;
            };
            webView.LoadFinished += delegate {
                UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
            };

            webView.ScalesPageToFit = true;
            webView.SizeToFit ();
            webView.LoadRequest (url);

            this.View.AddSubview (webView);
            this.View.AddSubview (navBar);
        }
开发者ID:ganeshan,项目名称:Monospace11,代码行数:34,代码来源:WebViewController.cs

示例12: SetupPicker

        private void SetupPicker()
        {
            // Setup the picker and model
            PickerModel model = new PickerModel(this.colors);
            model.PickerChanged += (sender, e) => {
                this.selectedColor = e.SelectedValue;
            };

            UIPickerView picker = new UIPickerView();
            picker.ShowSelectionIndicator = true;
            picker.Model = model;

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

            // Create a 'done' button for the toolbar and add it to the toolbar
            UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                                             (s, e) => {
                this.ColorTextField.Text = selectedColor;
                this.ColorTextField.ResignFirstResponder();
            });
            toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);

            // Tell the textbox to use the picker for input
            this.ColorTextField.InputView = picker;

            // Display the toolbar over the pickers
            this.ColorTextField.InputAccessoryView = toolbar;
        }
开发者ID:13daysaweek,项目名称:MonoTouchUIPickerView,代码行数:32,代码来源:MonoTouchUIPickerViewViewController.cs

示例13: UiSetKeyboardEditorWithCloseButton

        public static void UiSetKeyboardEditorWithCloseButton(this UITextField txt, UIKeyboardType keyboardType)
        {
            var toolbar = new UIToolbar
            {
                BarStyle = UIBarStyle.Black,
                Translucent = true,
            };
            txt.KeyboardType = keyboardType;
            toolbar.SizeToFit();

            var text = new UITextView(new CGRect(0, 0, 200, 32))
            {
                ContentInset = UIEdgeInsets.Zero,
                KeyboardType = keyboardType,
                Text = txt.Text,
                UserInteractionEnabled = true
            };
            text.Layer.CornerRadius = 4f;
            text.BecomeFirstResponder();

            var doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
                                 (s, e) =>
                {
                    text.ResignFirstResponder();
                    txt.ResignFirstResponder();
                });

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

            txt.InputAccessoryView = toolbar;
        }
开发者ID:nodoid,项目名称:mvvmlight1,代码行数:32,代码来源:UIUtils.cs

示例14: ViewDidLoad

        public override void ViewDidLoad ()
        {
            base.ViewDidLoad ();
            navBar = new UIToolbar();
            navBar.Frame = new CGRect (0, View.Frame.Height-40, View.Frame.Width, 40);
            navBar.TintColor = UIColor.Gray;

            items = new [] {
                new UIBarButtonItem (UIBarButtonSystemItem.Stop, (o, e) => {
                    webView.StopLoading ();
                    DismissViewController (true, null);
                }),
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace, null),
                new UIBarButtonItem (UIBarButtonSystemItem.Refresh, (o, e) => webView.Reload ())
            };

            navBar.Items = items;
            webView = new UIWebView ();
            webView.Frame = new CGRect (0, 0, View.Frame.Width, View.Frame.Height-40);
            webView.ScalesPageToFit = true;
            webView.SizeToFit ();
            webView.LoadRequest (url);

            navBar.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin;
            webView.AutoresizingMask = UIViewAutoresizing.FlexibleDimensions;

            View.AddSubviews (new UIView[] { webView, navBar });
        }
开发者ID:VDBBjorn,项目名称:toggl_mobile,代码行数:28,代码来源:WebViewController.cs

示例15: ViewDidLoad

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

			string selectedColor = "";

			PickerModel model = new PickerModel();
			model.ValueChanged += (sender, e) => {
				selectedColor = model.SelectedItem;
			};

			UIPickerView picker = new UIPickerView();
			picker.ShowSelectionIndicator = false;
			picker.BackgroundColor = UIColor.White;
			picker.Model = model;

			this.color.Text = model.SelectedItem;

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

			UIBarButtonItem doneButton = new UIBarButtonItem("Done", UIBarButtonItemStyle.Done,
				(s, e) => {
					this.color.Text = selectedColor;
					this.color.ResignFirstResponder();
				});
			toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);

			this.color.InputView = picker;

			this.color.InputAccessoryView = toolbar;
		}
开发者ID:mhalkovitch,项目名称:Xamarim,代码行数:34,代码来源:PickerExampleViewController.cs


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