Ian Vink
Ian Vink

Reputation: 68840

MonoTouch: UpPopoverController.DidDismiss not firing

I have a UIPopoverController that has the DidDismiss wired up:

           popYear.PresentFromBarButtonItem(btnYear,UIPopoverArrowDirection.Any,true);

           popYear.DidDismiss += (sender, args) => {
              Console.WriteLine("Bye bye");
           };

The DidDismiss fires fine when the popover is closed by the user tapping outside the popover.

But, when the popover is closed from with in the viewcontroller that it is hosting, the DidDismiss does not fire:

        tbhCLose.Tapped+= () => {
           if(PopOver!=null)
             PopOver.Dismiss(false); //Won't cause DidDismiss to fire
        };

Upvotes: 1

Views: 272

Answers (1)

Ian Vink
Ian Vink

Reputation: 68840

The DidDismiss does not fire when popover.Dismiss is called.

Better option is to listen to the viewconvtroller's ViewDisappearing and do the updates there"

           var uc = new YearViewController(SelectedYear);
           uc.ViewDisappearing+= (sender, e) => {
              this.SelectedYear = uc.SelectedYear;
              Update();
           };
           popYear = new UIPopoverController(uc);
           uc.PopOver = popYear;
           popYear.PresentFromBarButtonItem(btnYear,UIPopoverArrowDirection.Any,true);

Upvotes: 1

Related Questions