void Share(NSObject sender) { if (ImageView.Image == null) { return; } var items = new NSObject[] { ImageView.Image }; activityViewController = new UIActivityViewController(items, null) { ModalPresentationStyle = UIModalPresentationStyle.Popover, RestorationIdentifier = "Activity" }; if (activityViewController.PopoverPresentationController != null) { activityViewController.PopoverPresentationController.BarButtonItem = (UIBarButtonItem)sender; } SetupActivityCompletion(); TryDismiss(currentFilterViewController, () => { // the filter view controller was dismissed currentFilterViewController = null; // now show our activity view controller PresentViewController(activityViewController, true, null); }); }
void DidDismissPopover(UIPopoverPresentationController popoverPresentationController) { UIViewController testVC = popoverPresentationController.PresentedViewController; if (testVC == currentFilterViewController) { currentFilterViewController = null; } }
void CreateAndPresentFilterVC(UIBarButtonItem sender, ImageFilter filter, string identifier) { currentFilterViewController = (FilterViewController)Storyboard.InstantiateViewController(identifier); currentFilterViewController.Filter = filter; currentFilterViewController.ModalPresentationStyle = UIModalPresentationStyle.Popover; currentFilterViewController.PopoverPresentationController.BarButtonItem = sender; currentFilterViewController.UserActivity = UserActivity; // so "WasDismissed" can be called currentFilterViewController.MasterViewController = this; // so "popoverPresentationControllerDidDismissPopover" can be called currentFilterViewController.PopoverPresentationController.WeakDelegate = this; PresentViewController(currentFilterViewController, true, () => UpdateImage(false, false)); }
// We are notified when our FilterViewController is // being dismissed on its own public void WasDismissed() { currentFilterViewController = null; }
void Share(NSObject sender) { if (ImageView.Image == null) return; var items = new NSObject[] { ImageView.Image }; activityViewController = new UIActivityViewController (items, null) { ModalPresentationStyle = UIModalPresentationStyle.Popover, RestorationIdentifier = "Activity" }; if(activityViewController.PopoverPresentationController != null) activityViewController.PopoverPresentationController.BarButtonItem = (UIBarButtonItem)sender; SetupActivityCompletion (); TryDismiss (currentFilterViewController, () => { // the filter view controller was dismissed currentFilterViewController = null; // now show our activity view controller PresentViewController (activityViewController, true, null); }); }
void CreateAndPresentFilterVC(UIBarButtonItem sender, ImageFilter filter, string identifier) { currentFilterViewController = (FilterViewController)Storyboard.InstantiateViewController (identifier); currentFilterViewController.Filter = filter; currentFilterViewController.ModalPresentationStyle = UIModalPresentationStyle.Popover; currentFilterViewController.PopoverPresentationController.BarButtonItem = sender; currentFilterViewController.UserActivity = UserActivity; // so "WasDismissed" can be called currentFilterViewController.MasterViewController = this; // so "popoverPresentationControllerDidDismissPopover" can be called currentFilterViewController.PopoverPresentationController.WeakDelegate = this; PresentViewController (currentFilterViewController, true, () => UpdateImage (false, false)); }
void DidDismissPopover (UIPopoverPresentationController popoverPresentationController) { UIViewController testVC = popoverPresentationController.PresentedViewController; if (testVC == currentFilterViewController) currentFilterViewController = null; }