我有一个 UIPopoverController ,它已将 DidDismiss 连接起来:
popYear.PresentFromBarButtonItem(btnYear,UIPopoverArrowDirection.Any,true);
popYear.DidDismiss += (sender, args) => {
Console.WriteLine("Bye bye");
};
当用户在弹出菜单外部点击来关闭弹出菜单时, DidDismiss 会正常运行。
但是,当弹出窗口从托管它的视图控制器中关闭时,不会触发 DidDismiss :
tbhCLose.Tapped+= () => {
if(PopOver!=null)
PopOver.Dismiss(false); //Won't cause DidDismiss to fire
};
最佳答案
调用popover.Dismiss时,不会触发DidDismiss。
更好的选择是听取viewconvtroller的ViewDisappearing并在那里进行更新”
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);
关于iphone - MonoTouch:UpPopoverController.DidDismiss不触发,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14544633/