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


C# UIPopoverController.PresentFromRect方法代码示例

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


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

示例1: SaveAndLaunchFile

        public Task SaveAndLaunchFile(Stream stream, string fileType)
        {
            if (OriginView == null) return Task.FromResult(true);

            var data = NSData.FromStream(stream);
            var width = 824;
            var height = 668;

            var popoverView = new UIView(new RectangleF(0, 0, width, height));
            popoverView.BackgroundColor = UIColor.White;
            var webView = new UIWebView();
            webView.Frame = new RectangleF(0, 45, width, height - 45);

            var b = new UIButton(UIButtonType.RoundedRect);
            b.SetTitle("Done", UIControlState.Normal);
            b.Frame = new RectangleF(10,10, 60, 25);
            b.TouchUpInside += (o, e) => _popoverController.Dismiss(true);

            popoverView.AddSubview(b);
            popoverView.AddSubview(webView);

            var bundlePath = NSBundle.MainBundle.BundlePath;
            System.Diagnostics.Debug.WriteLine(bundlePath);
            webView.LoadData(data, "application/pdf", "utf-8", NSUrl.FromString("http://google.com"));

            var popoverContent = new UIViewController();
            popoverContent.View = popoverView;

            _popoverController = new UIPopoverController(popoverContent);
            _popoverController.PopoverContentSize = new SizeF(width, height);
            _popoverController.PresentFromRect(new RectangleF(OriginView.Frame.Width/2, 50, 1, 1), OriginView, UIPopoverArrowDirection.Any, true);
            _popoverController.DidDismiss += (o, e) => _popoverController = null;

            return Task.FromResult(true);
        }
开发者ID:reactiveui-forks,项目名称:VirtualSales,代码行数:35,代码来源:PlatformServices.cs

示例2: NumberEntryView

        public NumberEntryView()
        {
            BackgroundColor = UIColor.White;
            BorderStyle = UITextBorderStyle.RoundedRect;
            this.KeyboardType = UIKeyboardType.DecimalPad;
            this.ShouldBeginEditing = (t) =>{
                if(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone || popover != null && popover.PopoverVisible)
                    return true;
                var num = new NumberInputViewController(this);
                popover = new UIPopoverController(num){

                };
                popover.PresentFromRect(this.Frame,this.Superview, UIPopoverArrowDirection.Any,true);
                popover.DidDismiss += (object sender, EventArgs e) => {
                    this.ResignFirstResponder();
                    popover.Dispose();
                    num.Dispose();
                    popover = null;
                };

                this.SelectAll(this);
                return true;
            };
            this.EditingDidEnd += (s,e) => {
                if(NewValue != null)
                    NewValue(Text);
                if(popover != null && popover.PopoverVisible)
                    popover.Dismiss(true);
            };
            this.InputView = new UIView (new RectangleF (0, 0, 0, 0));
        }
开发者ID:nagyist,项目名称:iPadPos,代码行数:31,代码来源:NumberEntryView.cs

示例3: ShareUrl

        public void ShareUrl(object sender, Uri uri)
        {
            var item = new NSUrl(uri.AbsoluteUri);
            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);

                var barButtonItem = sender as UIBarButtonItem;
                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.RootViewController;
                viewController.PresentViewController(activityController, true, null);
            }
        }
开发者ID:zdd910,项目名称:CodeHub,代码行数:29,代码来源:ActionMenuFactory.cs

示例4: OnElementChanged

        protected override void OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs<Xamarin.Forms.Button> e)
        {
            base.OnElementChanged (e);

            if (e.NewElement != null) {
                Control.TouchUpInside += delegate(object sender, EventArgs e2) {

                    var formsView = new CommonFormsView ();

                    var rect = new CGRect (0, 0, 400, 400);
                    var iOSView = FormsViewToNativeiOS.ConvertFormsToNative (formsView, rect);

                    var viewController = new UIViewController();
                    viewController.Add(iOSView);
                    viewController.View.Frame = rect;

                    var popoverController = new UIPopoverController(viewController);
                    popoverController.ContentViewController.View.BackgroundColor = viewController.View.BackgroundColor;
                    popoverController.PopoverContentSize = rect.Size;
                    var frame = UIApplication.SharedApplication.KeyWindow.RootViewController.View.Frame;
                    popoverController.PresentFromRect (Control.Frame, UIApplication.SharedApplication.KeyWindow.RootViewController.View, 0, true);

                };
            }
        }
开发者ID:berlamont,项目名称:LoadingFormsViewFromNative,代码行数:25,代码来源:NativeButtonRenderer.cs

示例5: PresentFromPopover

 public void PresentFromPopover(UIView sender,float x,float y)
 {
     popover = new UIPopoverController(this)
     {
         PopoverContentSize = new SizeF(400, 590)
     };
     popover.PresentFromRect (new CoreGraphics.CGRect (x, y, 1, 1), sender, UIPopoverArrowDirection.Any, true);
     this.View.Layer.Frame = new CoreGraphics.CGRect (0, 0, 400, 590);
 }
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:9,代码来源:QualityMetricsASA.cs

示例6: PresentFromPopover

        public void PresentFromPopover(UIView sender,float x,float y,float vwidth)
        {
            popover = new UIPopoverController(this)
            {

                PopoverContentSize = new SizeF(vwidth, 600)
            };
            popover.PresentFromRect (new CoreGraphics.CGRect (x, y, 1, 1), sender, UIPopoverArrowDirection.Any, true);
        }
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:9,代码来源:ImagesGalleryView.cs

示例7: PresentFromPopover

        public void PresentFromPopover(UIView sender)
        {
            popover = new UIPopoverController(this)
            {
                PopoverContentSize = new SizeF(320, 350)
            };

            var frame = new RectangleF(0, 0,(float)sender.Frame.Width, (float)sender.Frame.Height);
            popover.PresentFromRect(frame, sender, UIPopoverArrowDirection.Down, true);
        }
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:10,代码来源:FacilityDropDownViewController.cs

示例8: TakePicture

        public static void TakePicture(UIViewController parent, Action<NSDictionary> callback)
        {
            Init ();
            picker.SourceType = UIImagePickerControllerSourceType.Camera;
            _callback = callback;

            if (AppDelegate.UserInterfaceIdiomIsPhone == false) {
                popover = new UIPopoverController (picker);
                popover.PresentFromRect (new RectangleF (150, 150, 500, 500), parent.View, UIPopoverArrowDirection.Any, true);
            } else {
                parent.PresentViewController (picker, true, null);
            }
        }
开发者ID:valryon,项目名称:pixpuzzle,代码行数:13,代码来源:Camera.cs

示例9: ShowPopoverAsync

        public async void ShowPopoverAsync(NSObject sender)
        {
            // Set the sender to a UIButton.
            UIButton tappedButton = (UIButton)sender;

            var content = new PopoverContentViewController();
            DetailPopover = new UIPopoverController(content);
            DetailPopover.PopoverContentSize = new SizeF(375, 375);
            DetailPopover.PresentFromRect(tappedButton.Frame, View, UIPopoverArrowDirection.Any, true);

            // await! control returns to the caller
            var result = await WaitAsync();

            content.WebViewContent = result;
        }
开发者ID:ChaseCarlile,项目名称:HelloWorld_Async,代码行数:15,代码来源:MyViewController.cs

示例10: ShareUrl

		public void ShareUrl(string url)
		{
            var item = new NSUrl(new Uri(url).AbsoluteUri);
            var activityItems = new NSObject[] { item };
            UIActivity[] applicationActivities = null;
            var activityController = new UIActivityViewController (activityItems, applicationActivities);


            if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad) {
                var window = ((UIApplicationDelegate)UIApplication.SharedApplication.Delegate).Window;

                var pop = new UIPopoverController (activityController);
                pop.PresentFromRect (new CoreGraphics.CGRect (window.RootViewController.View.Frame.Width / 2, window.RootViewController.View.Frame.Height / 2, 0, 0),
                    window.RootViewController.View, UIPopoverArrowDirection.Any, true);

            } else {
                _modalHost.PresentModalViewController(activityController, true);

            }
		}
开发者ID:xNUTs,项目名称:CodeBucket,代码行数:20,代码来源:ShareService.cs

示例11: ViewDidLoad

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

            // make the main content area scroll over two pages
            this.scrollView.ContentSize = new SizeF (this.scrollView.Bounds.Width * 2, this.scrollView.Bounds.Height);
            this.scrollView.PagingEnabled = true;

            // add page one
            var nibObjects = NSBundle.MainBundle.LoadNib("DashboardPageOneView", this, null);
            _pageOne = (DashboardPageOneView)Runtime.GetNSObject(nibObjects.ValueAt(0));
            _pageOne.Frame = this.scrollView.Bounds;
            this.scrollView.Add(_pageOne);

            // add page two
            nibObjects = NSBundle.MainBundle.LoadNib("DashboardPageTwoView", this, null);
            _pageTwo = (DashboardPageTwoView)Runtime.GetNSObject(nibObjects.ValueAt(0));
            _pageTwo.Frame = new RectangleF (new PointF(this.scrollView.Bounds.Width, 0), this.scrollView.Bounds.Size);
            this.scrollView.Add(_pageTwo);

            // Need to set the repo for our views
            FetchDataForRepo ("tastejs", "PropertyCross");

            // Add the touch handler to the repo summary
            this.repoSummary.SetTapHandler ( nameLabelFrame => {
                if(_repoSelectorVC == null) {
                    _repoSelectorVC = new RepoSelectorViewControllerController (_githubUserName, repoName => {
                        InvokeOnMainThread(() => {
                            _popover.Dismiss(true);
                            FetchDataForRepo (_githubUserName, repoName);
                        });
                    });
                }
                _popover = new UIPopoverController(_repoSelectorVC);
                _popover.PresentFromRect (nameLabelFrame, this.repoSummary, UIPopoverArrowDirection.Up, true);
            });
        }
开发者ID:rid00z,项目名称:GithubDashboard-Xamarin,代码行数:37,代码来源:GithubDashboardViewController.cs

示例12: Selected

        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            picker = new DatePickerController (DateValue);
            nav = new UINavigationController (picker);
            popover = new UIPopoverController (nav);

            if (UIDevice.CurrentDevice.CheckSystemVersion (7, 0)) {
                picker.PreferredContentSize = DatePickerSize;
                nav.PreferredContentSize = DatePickerSize;
            } else {
                picker.ContentSizeForViewInPopover = DatePickerSize;
                nav.ContentSizeForViewInPopover = DatePickerSize;
            }

            popover.PopoverContentSize = DatePickerSize;

            nav.Delegate = new DatePickerNavigationDelegate ();
            picker.DatePicked += OnDatePicked;
            picker.Popover = popover;

            var cell = GetActiveCell ();

            //popover.DidDismiss += (sender, e) => {
            //	popover.Dispose ();
            //	popover = null;
            //	picker.Dispose ();
            //	picker = null;
            //};

            popover.PresentFromRect (cell.Frame, tableView, UIPopoverArrowDirection.Up, true);
        }
开发者ID:pahlot,项目名称:FlightLog,代码行数:31,代码来源:DateEntryElement.cs

示例13: PresentFromPopover

        public void PresentFromPopover(UIView sender,float x,float y,float vwidth )
        {
            popover = new UIPopoverController(this)
            {

                PopoverContentSize = new SizeF(vwidth, uvheight)

            };

            //this.View.Layer.Frame = new CoreGraphics.CGRect (0, 0, width, Height+88);
            //	this.mutListView.Layer.Frame = new CoreGraphics.CGRect (0, 88, width, Height);
            //this.NavBar.Layer.Frame = new CoreGraphics.CGRect (0, 0, width, 44);
            //this.searchBar.Layer.Frame = new CoreGraphics.CGRect (0, 44, width, 44);
            //this.mutListView.BackgroundColor = UIColor.Red;
            //mutListView.TranslatesAutoresizingMaskIntoConstraints = false;
            //View.AddConstraint (
            //	NSLayoutConstraint.Create ( mutListView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 0, width)
            //);

            popover.PresentFromRect (new CoreGraphics.CGRect (x, y, 1, 1), sender, UIPopoverArrowDirection.Any, true);
            this.View.Layer.Frame = new CoreGraphics.CGRect (0, 0, vwidth, uvheight);
        }
开发者ID:Nahidahmed,项目名称:iProPQRS,代码行数:22,代码来源:mCodePicker.cs

示例14: PresentPopover

 /// <summary>
 /// Presents popover
 /// </summary>
 private void PresentPopover(UIViewControllerWithPopover viewCtrl, RectangleF frame)
 {
     var popoverController = new UIPopoverController(viewCtrl);
     viewCtrl.PopoverController = popoverController;
     popoverController.PresentFromRect(frame, View, UIPopoverArrowDirection.Any, true);
 }
开发者ID:xuanvu,项目名称:mTouch-PDFReader,代码行数:9,代码来源:DocumentViewController.cs

示例15: Selected

		public void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			if (picker == null)
				picker = new UIImagePickerController();
			picker.Delegate = new MyDelegate(this, tableView, path);

			switch (UIDevice.CurrentDevice.UserInterfaceIdiom)
			{
				case UIUserInterfaceIdiom.Pad:
					RectangleF useRect;
					popover = new UIPopoverController(picker);
					var cell = tableView.CellAt(path);
					if (cell == null)
						useRect = rect;
					else
						useRect = cell.Frame;
					popover.PresentFromRect(useRect, dvc.View, UIPopoverArrowDirection.Any, true);
					break;
				default:
				
				case UIUserInterfaceIdiom.Phone:
					dvc.ActivateController(picker, dvc);
					break;
			}
			currentController = dvc;
		}
开发者ID:anujb,项目名称:MonoMobile.MVVM,代码行数:26,代码来源:ImageElement.cs


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