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


C# UIBarButtonItem类代码示例

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


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


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