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

C# UIBarButtonItem类代码示例

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

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



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

示例1: ViewDidLoad

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

            var camera = CameraPosition.FromCamera (-37.81969, 144.966085, 4);
            mapView = MapView.FromCamera (RectangleF.Empty, camera);
            View = mapView;

            mapView.LongPress += HandleLongPress;

            // Add a default marker around Sydney.
            var sydneyMarker = new Marker () {
                Title = "Sydney!",
                Icon = UIImage.FromBundle ("glow-marker"),
                Position = new CLLocationCoordinate2D (-33.8683, 151.2086),
                Map = mapView
            };

            // Create a list of markers, adding the Sydney marker.
            markers = new List<Marker> () { sydneyMarker };

            // Create a button that, when pressed, updates the camera to fit the bounds
            // of the specified markers.
            var fitBoundsButton = new UIBarButtonItem ("Fit Bounds", UIBarButtonItemStyle.Plain, DidTapFitBounds);
            NavigationItem.RightBarButtonItem = fitBoundsButton;
        }
开发者ID:WinterGroveProductions,项目名称:monotouch-bindings,代码行数:26,代码来源:FitBoundsViewController.cs


示例2: ViewDidLoad

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

            NavigationItem.TitleView = new UIImageView(UIImage.FromFile("Images/RusLogoStackBlkPPT.png"));

            items = new List<string>()
            {
                "Market Insights",
                "Russell Newsroom",
                "US Indexes",
                "Global Indexes",
                "Twitter"
            };

            var about = new UIBarButtonItem("About", UIBarButtonItemStyle.Bordered, null);
            about.Clicked += delegate(object sender, EventArgs e) {
                AboutViewController aboutView = new AboutViewController();
                aboutView.Title = "About";
                this.NavigationController.PushViewController(aboutView, true);
            };
            ToolbarItems = new UIBarButtonItem[] {about};

            TableView.DataSource = new TableViewDataSource(items);
            TableView.Delegate = new TableViewDelegate(this);
            TableView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight|UIViewAutoresizing.FlexibleWidth;
            TableView.BackgroundColor = UIColor.Clear;
            TableView.Frame = new RectangleF (0, 0, this.View.Frame.Width, this.View.Frame.Height);
        }
开发者ID:NotMyself,项目名称:BigRReader,代码行数:29,代码来源:MainMenuViewController.cs


示例3: ViewDidLoad

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

			webView = new UIWebView (new RectangleF(0, (_addCancelButton) ? navigationBarHeight : 0, View.Frame.Width, (_addCancelButton) ? View.Frame.Height - navigationBarHeight : View.Frame.Height));
			webView.Delegate = new WebViewDelegate(RequestStarted, RequestFinished);

			if (!_addCancelButton) {
				this.View.AddSubview (webView);
			} else {
				var cancelButton = new UIBarButtonItem (UIBarButtonSystemItem.Cancel);
				cancelButton.Clicked += (object sender, EventArgs e) => {
					_cancelled();
					this.DismissViewController(true, null);
				};

				var navigationItem = new UINavigationItem {
					LeftBarButtonItem = cancelButton
				};

				navigationBar = new UINavigationBar (new RectangleF (0, 0, View.Frame.Width, navigationBarHeight));
				navigationBar.PushNavigationItem (navigationItem, false);

				this.View.AddSubviews (navigationBar, webView);
			}
		}
开发者ID:robertherber,项目名称:PersonalTasks,代码行数:26,代码来源:BaseAuthenticationViewController.cs


示例4: CommitView

        public CommitView()
        {
			_viewSegment = new UISegmentedControl(new [] { "Changes", "Comments", "Approvals" });
			_viewSegment.SelectedSegment = 0;
			_viewSegment.ValueChanged += (sender, e) => Render();
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:7,代码来源:CommitView.cs


示例5: ViewDidLoad

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

		Title = "Text View";
		textView = new UITextView (View.Frame){
			TextColor = UIColor.Black,
			Font = UIFont.FromName ("Arial", 18f),
			BackgroundColor = UIColor.White,
			Text = "This code brought to you by ECMA 334, ECMA 335 and the Mono Team at Novell\n\n\nEmbrace the CIL!",
			ReturnKeyType = UIReturnKeyType.Default,
			KeyboardType = UIKeyboardType.Default,
			ScrollEnabled = true,
			AutoresizingMask = UIViewAutoresizing.FlexibleHeight,
		};

		// Provide our own save button to dismiss the keyboard
		textView.Started += delegate {
			var saveItem = new UIBarButtonItem (UIBarButtonSystemItem.Done, delegate {
				textView.ResignFirstResponder ();
				NavigationItem.RightBarButtonItem = null;
				});
			NavigationItem.RightBarButtonItem = saveItem;
		};

		View.AddSubview (textView);
	}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:27,代码来源:textview.cs


示例6: OnShareClicked

		public void OnShareClicked(UIBarButtonItem button)
		{
			UIActivityViewController activityViewController = new UIActivityViewController (new NSObject[] {
				ImageView.Image
			}, null);
			var popover = activityViewController.PopoverPresentationController;
			if (popover != null) {
				popover.BarButtonItem = ShareItem;
			}

			// Set a completion handler to handle what the UIActivityViewController returns
			activityViewController.SetCompletionHandler ((activityType, completed, returnedItems, error) => {
				if (returnedItems == null
				   || returnedItems.Length == 0)
					return;

				NSExtensionItem extensionItem = returnedItems [0];
				NSItemProvider imageItemProvider = extensionItem.Attachments [0];

				if (!imageItemProvider.HasItemConformingTo(UTType.Image))
					return;

				imageItemProvider.LoadItem (UTType.Image, null, (item, loadError) => {
					if (item != null && loadError == null)
						InvokeOnMainThread (() => {
							ImageView.Image = (UIImage)item;
						});
				});
			});

			PresentViewController (activityViewController, true, null);
		}
开发者ID:g7steve,项目名称:monotouch-samples,代码行数:32,代码来源:ImageShareViewController.cs


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


示例8: ViewDidLoad

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

            var signButton = new UIBarButtonItem ("Sign PDF", UIBarButtonItemStyle.Plain, (o,e) => ShowPDFForSigning ());
            NavigationItem.RightBarButtonItem = signButton;
        }
开发者ID:rid00z,项目名称:Xamarin-iOS-SignatureStarterKit,代码行数:7,代码来源:SignViewController.cs


示例9: ViewDidLoad

        /// <remarks>
        /// Background image idea from 
        /// http://mikebluestein.wordpress.com/2009/10/05/setting-an-image-background-on-a-uitableview-using-monotouch/
        /// </remarks>
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = "Speakers";

            //_speakerData = AppDelegate.ConferenceData.Speakers;
            speakerData = MonkeySpace.Core.ConferenceManager.Speakers.Values.ToList ();

            UIImageView imageView = new UIImageView (UIImage.FromFile ("Background.png"));
            imageView.Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height);
            imageView.UserInteractionEnabled = true;

            tableView = new UITableView { Source = new TableViewSource (this, speakerData)
                , AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth
                , BackgroundColor = UIColor.Clear
                , Frame = new RectangleF (0, 0, View.Frame.Width, View.Frame.Height - 44)
                , ShowsVerticalScrollIndicator = true};

            imageView.AddSubview (tableView);
            View.AddSubview (imageView);

            // SLIDEOUT BUTTON
            NavigationController.NavigationBar.SetTitleTextAttributes(AppDelegate.Current.FontTitleTextAttributes);
            var bbi = new UIBarButtonItem(UIImage.FromBundle ("Images/slideout"), UIBarButtonItemStyle.Plain, (sender, e) => {
                AppDelegate.Current.FlyoutNavigation.ToggleMenu();
            });
            NavigationItem.SetLeftBarButtonItem (bbi, false);

            tableView.BackgroundView = new UIImageView (UIImage.FromBundle ("Images/Background"));
        }
开发者ID:bramleffers,项目名称:MonkeySpace,代码行数:35,代码来源:SpeakersViewController.cs


示例10: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();
            addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, (s,e) =>{
                var filename = DateTime.Now.ToString ("yyyyMMdd_HHmmss") + ".task";
                if (AppDelegate.HasiCloud) {
                    var p1 = Path.Combine(AppDelegate.iCloudUrl.Path, "Documents");
                    var p2 = Path.Combine (p1, filename);
                    var ubiq = new NSUrl(p2, false);

                    var task = new TaskDocument(ubiq);
                    task.Save (task.FileUrl, UIDocumentSaveOperation.ForCreating
                    , (success) => {
                        Console.WriteLine ("Save completion:"+ success);
                        tasks.Add (task);
                        Reload();
                    });
                }
            });
            NavigationItem.RightBarButtonItem = addButton;

            // UIBarButtonSystemItem.Refresh or http://barrow.io/posts/iphone-emoji/
            refreshButton = new UIBarButtonItem('\uE049'.ToString ()
            , UIBarButtonItemStyle.Plain
            , (s,e) => {
                LoadTasks(null);
            });

            NavigationItem.LeftBarButtonItem = refreshButton;
            LoadTasks(null);
        }
开发者ID:AranHu,项目名称:TaskCloud,代码行数:31,代码来源:TaskListScreen.cs


示例11: ShareUrl

        public static void ShareUrl(string url, UIBarButtonItem barButtonItem = null)
        {
            try
            {
                var item = new NSUrl(url);
                var activityItems = new NSObject[] { item };
                UIActivity[] applicationActivities = null;
                var activityController = new UIActivityViewController (activityItems, applicationActivities);

                if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) 
                {
                    var window = UIApplication.SharedApplication.KeyWindow;
                    var pop = new UIPopoverController (activityController);

                    if (barButtonItem != null)
                    {
                        pop.PresentFromBarButtonItem(barButtonItem, UIPopoverArrowDirection.Any, true);
                    }
                    else
                    {
                        var rect = new CGRect(window.RootViewController.View.Frame.Width / 2, window.RootViewController.View.Frame.Height / 2, 0, 0);
                        pop.PresentFromRect (rect, window.RootViewController.View, UIPopoverArrowDirection.Any, true);
                    }
                } 
                else 
                {
                    var viewController = UIApplication.SharedApplication.KeyWindow.GetVisibleViewController();
                    viewController.PresentViewController(activityController, true, null);
                }
            }
            catch
            {
            }
        }
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:34,代码来源:AlertDialogService.cs


示例12: ViewDidLoad

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

			this.NavigationItem.HidesBackButton = true;
			if(isFrom == "")
				setAccountResponse (Constant.selectedAffialte );

			Appdata.setButtonBorder (btnSave);
			btnSave.BackgroundColor = Appdata.buttonBackgroundColor;

			if (UserInterfaceIsPhone)
				SetLayoytIPhone ();
			else
				SetLayoytIPad ();
			
			UIToolbar toolbar = new UIToolbar();
			toolbar.BarStyle = UIBarStyle.Default;
			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) => {
					Console.WriteLine ("Calling Done!");
				});
			toolbar.SetItems(new UIBarButtonItem[]{doneButton}, true);
		}
开发者ID:kumaralg2,项目名称:Jan28-TS,代码行数:28,代码来源:TSAccountBasicView.cs


示例13: ViewDidLoad

        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            var shift1Button = new UIBarButtonItem ();
            shift1Button.Title = "Shift 1";
            shift1Button.Style = UIBarButtonItemStyle.Bordered;
            var shift2Button = new UIBarButtonItem ();
            shift2Button.Title = "Shift 2";
            shift2Button.Style = UIBarButtonItemStyle.Bordered;
            SetToolbarItems (new UIBarButtonItem[] {
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace),
                shift1Button,
                shift2Button,
                new UIBarButtonItem (UIBarButtonSystemItem.FlexibleSpace)
            },false);
            NavigationController.ToolbarHidden = false;
            var labels = new [] { "Omega 3", "Herb", "RJ", "JD","RWA","NP", "NPO" };
            var segments = new SDSegmentedControl (labels) {
                Frame = new RectangleF (0, 0, 320, 44)
            };
            segments.ValueChanged += (sender, e) => {
                Console.WriteLine ("Selected " + segments.SelectedSegment);
                View.Add(new ProductionSegmentsTableView(new RectangleF (0, 44, View.Bounds.Width, View.Bounds.Height)));
                View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
            };

            View.AddSubview (segments);
            View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
        }
开发者ID:jeffbmiller,项目名称:mps,代码行数:29,代码来源:MainViewController.cs


示例14: WillShowViewController

        public override void WillShowViewController(UISplitViewController svc, UIViewController aViewController, UIBarButtonItem button)
        {
            _pc = null;
            _lefty = null;

            ReplaceDetailNavigationViewController();
        }
开发者ID:benhorgen,项目名称:monocross_helpers,代码行数:7,代码来源:SplitViewControllerDelegate.cs


示例15: ShowPDFForSigning

        public async void ShowPDFForSigning()
        {
            var currentFilePath = "Salesinvoice.pdf";

            QLPreviewItemBundle prevItem = new QLPreviewItemBundle ("Salesinvoice.pdf", currentFilePath);
            QLPreviewController previewController = new QLPreviewController ();
            previewController.DataSource = new PreviewControllerDS (prevItem);

            NavigationController.PushViewController (previewController, true);

            //this adds a button to the QLPreviewController, but it has to wait until after it's been loaded 
            //I'm not sure if there's a better way to do this.
            await System.Threading.Tasks.Task.Run( () =>
                {
                    System.Threading.Thread.Sleep( 500 );
                    for (int i = 0; i < 10; i++)
                    {
                        System.Threading.Thread.Sleep( 500 );
                        InvokeOnMainThread( () =>
                            {
                                if (previewController.NavigationItem.RightBarButtonItems.Length == 1)
                                {
                                    var signButton = new UIBarButtonItem( UIBarButtonSystemItem.Compose, (o, e ) =>
                                        {
                                            SignPDF();
                                        } );

                                    previewController.NavigationItem.RightBarButtonItems = 
                                        new UIBarButtonItem[] { signButton, previewController.NavigationItem.RightBarButtonItems[0] };                              
                                }
                            } );
                    }
                } );
        }
开发者ID:rid00z,项目名称:Xamarin-iOS-SignatureStarterKit,代码行数:34,代码来源:SignViewController.cs


示例16: ViewDidLoad

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

			_viewSegment = new UISegmentedControl(new object[] { "Open".t(), "Closed".t(), "Custom".t() });
			_segmentBarButton = new UIBarButtonItem(_viewSegment);
            _segmentBarButton.Width = View.Frame.Width - 10f;
			ToolbarItems = new [] { new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace), _segmentBarButton, new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace) };
			var vm = (MyIssuesViewModel)ViewModel;
			vm.Bind(x => x.SelectedFilter, x =>
			{
				if (x == 2)
				{
					ShowFilterController(new CodeHub.iOS.Views.Filters.MyIssuesFilterViewController(vm.Issues));
				}

                // If there is searching going on. Finish it.
                FinishSearch();
			});

			BindCollection(vm.Issues, CreateElement);
			var set = this.CreateBindingSet<MyIssuesView, MyIssuesViewModel>();
			set.Bind(_viewSegment).To(x => x.SelectedFilter);
			set.Apply();
        }
开发者ID:ryanseys,项目名称:CodeHub,代码行数:25,代码来源:MyIssuesView.cs


示例17: btnShare_Activated

 async partial void btnShare_Activated (UIBarButtonItem sender)
 {
     var text = viewModel.SharingMessage;
     var items = new NSObject[] { new NSString (text) };
     var activityController = new UIActivityViewController (items, null);
     await PresentViewControllerAsync (activityController, true);
 }
开发者ID:MikeCodesDotNet,项目名称:Beer-Drinkin,代码行数:7,代码来源:BeerDescriptionTableView.cs


示例18: ViewDidLoad

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			AddOption ("Save", CommitDataForm);
			
			// Perform any additional setup after loading the view, typically from a nib.
			this.DataForm = new TKDataForm (this.View.Bounds);
			this.DataForm.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
			this.DataForm.AllowScroll = false;
			dataFormDelegate = new DataFormDelegate ();
			this.DataForm.Delegate = dataFormDelegate;
			this.View.AddSubview (this.DataForm);

			this.DataSource =new TKDataFormEntityDataSourceHelper ("user", "json", (string)null);
			this.DataSource ["name"].Index = 0;
			this.DataSource ["age"].Index = 1;

			this.DataSource ["gender"].ValuesProvider = NSArray.FromStrings (new string[] { "Male", "Female" });
			this.DataSource ["gender"].EditorClass = new Class (typeof(TKDataFormSegmentedEditor));
			this.DataSource ["gender"].Index = 2;
			this.DataSource ["gender"].PickersUseIndexValue = false;

			this.DataSource ["email"].Index = 3;
			this.DataSource ["email"].EditorClass = new Class (typeof(TKDataFormEmailEditor));

			this.DataForm.WeakDataSource = this.DataSource.NativeObject;
			this.DataForm.CommitMode = TKDataFormCommitMode.Manual;

			UIBarButtonItem save = new UIBarButtonItem ("Save", UIBarButtonItemStyle.Done, this, new Selector ("CommitDataForm"));
			this.NavigationItem.RightBarButtonItem = save;
		}
开发者ID:tremors,项目名称:ios-sdk,代码行数:31,代码来源:DataFormJSONSupport.cs


示例19: ViewDidLoad

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

			//UI setup from code
			cancel.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			
			var label = new UILabel (new CGRect(0, 0, 80, 36)) { 
				Text = "Labor",
				TextColor = UIColor.White,
				BackgroundColor = UIColor.Clear,
				Font = Theme.BoldFontOfSize (18),
			};
			labor = new UIBarButtonItem(label);

			done = new UIBarButtonItem("Done", UIBarButtonItemStyle.Bordered, (sender, e) => {
				laborViewModel
					.SaveLaborAsync (assignmentViewModel.SelectedAssignment, laborViewModel.SelectedLabor)
					.ContinueWith (_ => BeginInvokeOnMainThread (() => DismissViewController (true, null)));
			});
			done.SetTitleTextAttributes (new UITextAttributes() { TextColor = UIColor.White }, UIControlState.Normal);
			done.SetBackgroundImage (Theme.BlueBarButtonItem, UIControlState.Normal, UIBarMetrics.Default);
			
			space1 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
			space2 = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

			tableView.Source = 
				tableSource = new TableSource();
		}
开发者ID:felipecembranelli,项目名称:MyXamarinSamples,代码行数:29,代码来源:AddLaborController.cs


示例20: CreateSaveButton

        private UIBarButtonItem CreateSaveButton()
        {
            var button = new UIBarButtonItem("Save", UIBarButtonItemStyle.Plain, null);
            button.Clicked += ((sender, args) => ((FriendViewModel)ViewModel).SaveCommand.Execute(null));

            return button;
        }
开发者ID:sbondini,项目名称:FriendList,代码行数:7,代码来源:FriendView.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# UIButton类代码示例发布时间:2022-05-24
下一篇:
C# UIAutomationClient类代码示例发布时间: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